Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Phill Ashworth
Theme with custom setting
June 13, 2012 5:26 AM
Answer

Phill Ashworth

Rank: New Member

Posts: 4

Join Date: June 6, 2012

Recent Posts

I'm developing a theme with a variation using custom settings as described in the Development Guide.
My 2 themes appear as expected and I can apply either one of them to all the public pages and the setting works correctly as per the example.

 1
 2<theme id="deep-blue" name="Deep Blue">
 3    <settings>
 4        <setting key="header-type" value="detailed" />
 5    </settings>
 6</theme>
 7<theme id="deep-blue-mini" name="Deep Blue Mini">
 8    <settings>
 9        <setting key="header-type" value="brief" />
10    </settings>
11</theme>
12
13#if ($theme.getSetting("header-type") == "detailed")
14    #parse ("$full_templates_path/header_detailed.vm")
15#else
16    #parse ("$full_templates_path/header_brief.vm")
17#end


However if I apply an alternative theme to a single page with "Define a specific look and feel for this page" the page does not display with the specific theme but seems to use the default for the public pages.

Any ideas why the page is not using the specified theme?
Namrata Hangal
RE: Theme with custom setting
June 13, 2012 5:35 AM
Answer

Namrata Hangal

Rank: Regular Member

Posts: 161

Join Date: July 26, 2010

Recent Posts

I'm assuming you're using the version 6.1
Not too sure if settings are the same as they were in the earlier versions of Liferay, but can you please check the Manage->Pages option (if it's still there!) and try to select the required theme.

Else, there should be a UI based selection possible - just not sure what they call it in 6.1
Will check and revert

Regards,
Namrata
Phill Ashworth
RE: Theme with custom setting
June 13, 2012 7:18 AM
Answer

Phill Ashworth

Rank: New Member

Posts: 4

Join Date: June 6, 2012

Recent Posts

That's right - version 6.1.0

I'm going to Manage -> Page Layout, then I select my page and choose "Look and Feel" and select my theme.
The chosen theme is correctly saved but the view still shows the default theme.
Muzakir Khan
RE: Theme with custom setting
June 16, 2012 12:05 AM
Answer

Muzakir Khan

Rank: Regular Member

Posts: 112

Join Date: March 14, 2012

Recent Posts

Phill Ashworth:
I'm developing a theme with a variation using custom settings as described in the Development Guide.
My 2 themes appear as expected and I can apply either one of them to all the public pages and the setting works correctly as per the example.

 1
 2<theme id="deep-blue" name="Deep Blue">
 3    <settings>
 4        <setting key="header-type" value="detailed" />
 5    </settings>
 6</theme>
 7<theme id="deep-blue-mini" name="Deep Blue Mini">
 8    <settings>
 9        <setting key="header-type" value="brief" />
10    </settings>
11</theme>
12
13#if ($theme.getSetting("header-type") == "detailed")
14    #parse ("$full_templates_path/header_detailed.vm")
15#else
16    #parse ("$full_templates_path/header_brief.vm")
17#end


However if I apply an alternative theme to a single page with "Define a specific look and feel for this page" the page does not display with the specific theme but seems to use the default for the public pages.

Any ideas why the page is not using the specified theme?


Hi!
Plz check out that you are making changes in the portal_normal.vm file that is present in _diffs folder. The correct path for customising portal_normal.vm is "Your Custom Theme -> _diffs -> templates -> portal_normal.vm".., But I think so you are making changes in this wrong path "Your Custom Theme -> templates -> portal_normal.vm.
I have included a sample screenshot of my custom theme's path.. It will give you the idea of exact customising path..

Or else after applying new look and feel, just refresh the page and observe for applied theme changes, it should work... There is no connection between changing look and feel and restarting your server..
Attachment

Attachments: Screenshot1.png (30.8k)
S L B
RE: Theme with custom setting
July 16, 2012 3:54 PM
Answer

S L B

Rank: New Member

Posts: 23

Join Date: July 28, 2008

Recent Posts

I'm having this same problem with a custom theme created with four variations based on a setting in liferay-look-and-feel.xml on liferay 6.1 too. Whatever I do my pages just keep the default sitewide theme unless I select the Classic theme as the sitewide default and define a specific look and feel for every single page in the site.

Currently I'm planning to debug and step through LayoutImpl.getTheme tomorrow because I don't think our admins want to set the theme for every single page.
S L B
RE: Theme with custom setting
July 20, 2012 2:44 PM
Answer

S L B

Rank: New Member

Posts: 23

Join Date: July 28, 2008

Recent Posts

So it's LayoutImpl.getThemeSetting() that returns the wrong value in these circumstances. The Layout doesn't have any value for the custom setting for the custom theme, so the function defaults to the parent LayoutSet's getThemeSetting() method, which in turn eventually calls theme.getSetting(), but for the LayoutSet theme, not the Layout's theme. Which is why it always ends up looking like the default.

I just changed ThemeDisplay.getThemeSetting() to just call theme.getSetting() instead of Layout.getThemeSetting(). It was a lot quicker than fixing Layout.getThemeSetting(). I'd be glad to know why that's a bad idea though.