Preview Theme functionality in Cakephp3 - cakephp

In my AppController i'm assigning the active theme like this:
$this->viewBuilder()->theme($this->Themes->active_theme());
I've created a page which shows all my themes (I'm using a json file for this), i want to add a preview theme functionality to every theme in my page just like wordpress, drupal etc.
I'm not sure how to can i temporarily load a theme using app controller for previewing purpose.
Any help on how this functionality works and how can i do it in Cakephp would save my day.

In your preview function, call $this->viewBuilder()->theme($previewTheme);? Seems pretty straight-forward, am I missing something?

Related

ddrmenu razor doesn't show anything in dotnetnuke

For our website we want to use a megamenu that is created with razor.
In the Gravity skin folder of DNN, we have created a folder called MegaMenuNav and we have added our MegaMenu.cshtml and menudef.xml into it.
We have downloaded the ddrmenu example and used it like this:
<dnn:MENU ID="MENU" MenuStyle="MegaMenuNav" runat="server" NodeSelector="*"></dnn:MENU>
we get no error, but nothing is shown as well.
All of the example menus that use token or xslt, such as Dropdown and Mega2DNN are shown, but when we use Razor menus, nothing is shown.
For testing, we added a simple text inside our MegaMenu.cshtml, but again we got no result
Is there anything to do with dotnetnuke?
BTW, we are using .Net 4.5 and Dnn 8.0.2
Thanks in advance

CakePHP - Letting the User Select the Layout

Im working on a CakePHP application that will display a DVD collection. I would like to include a Dropdpwn Menu where the user can select their on view/colour scheme. Nothing fancy, it just needs to either change the layout file for the CSS file. Either will work.
Any tips? Can't seem to figure it out.
Regards,
Jon
Use Themes to switch either layout, css, or both.
In your AppController.php add:
$this->theme = 'Fancy';
This will look for your default layout in App/View/Themed/Fancy/default.ctp. You choose what you want to customize with a theme. If you don't have a special layout file for the Fancy theme, CakePHP will default to App/View/Layouts/default.ctp. Likewise, you can choose to provide a special stylesheet in your theme which would go in App/View/Themed/Fancy/webroot/css/default.css and if not CakePHP would use App/View/webroot/css/default.css.
You can set the user's theme selection to a Cookie so it's remembered.
You didn't say which version of CakePHP you're using, but the solution will be similar in either 2.x or 3. The above links are to the 2.x Cookbook.

Adding layout templates to WebSphere Portal theme ear

Question: How do I refer to my layout files form the changeLayout.json and layout.json files if the layout-template files are held in a theme ear/ear?
Background:
I'm developing a custom theme with custom layouts in Portal v8. I'm using the ear method for the theme deployment,s o I've got everything segregated into MyThemeDynamic.war and MyThemeStatic.war I've added my layout files to MyThemeStatic.war/themes/MyTheme/layout-templates
When I set the default layout template in the XMLAccess import, I can successfully see my custom layout.
But If I try to change the layout, it reverts back to the Portal 8.0 theme defaults.
I've tried several ways of referring to my layout files from layout.json.
I saw this: http://tinyurl.com/ch2nczp
but it prevents the default theme from working properly, and I want to keep both the default and this new custom theme.
I've also tried adding references to the xml access, as suggested here: https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14909102&#14909102
I feel like I'm close, but I'm missing something.
I combined static and dynamic theme assets into a single war file following these instructions:
http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Create_a_custom_theme_without_WebDAV_with_8.0
That was ultimately what worked.

Use the plugins layout instead of the apps layout if it is available CakePHP

We have developed a CakePHP (1.3) application which works fine. Before usage users have to login. Nothing new there.
We also created a plugin containing a "sales website". It's styling is completely different from the applications design. The sales website works ok, but the loginpage is now based upon the applications layout (path: /users/login). We would like to apply the sales websites layout. But only when the plugin is available.
Is this possible? And if so, is it possible without the need to add a login method and/or users controller to the plugin?
You can use App::objects('plugin') to get a list of available plugins in your app. just do an array_search fro your plugin name and switch the layout accordingly

Cakephp: cannot login if using a theme

I am not a newbie cakephp developer however I won't call myself as an intermediate level cakephp programmer.
I came across a strange behavor what I could not handle.
I've build up an app with default views. First customer needs themeing so I decided to use the cakephp theme feature and started to make a theme with views, layouts etc.
I am using cakephp 1.3.8.
Everything works fine except I can't log in. Cakephp redirects me to an impossible place, the search controller with search results. It simply could not happen.
With the default views everything works fine.
What could be the reason? Could it be a bug in Auth component? Where should I start to debug this and how?
Thanks.
edit:
I made a copy of my default views into a new theme, and changed the $theme variable to this new theme. Everything works, so Auth and Theme facilities are fine, the reason should be my first theme. How a theme, or view file affects on login processing and/or Auth redirections? I still do not know how to find the bug in my views :(. I've set debug to 2, also checked the logs in tmp/logs but there ares now infos. Any idea?
SOLVED
I found the problem, a $this->Form->end() was missing from the searchbox element so the login data was submitted to the products controller search method, therefore the login wasn't processed.
Was my fault.

Resources