留言板

Theme with custom setting

Phill Ashworth,修改在11 年前。

Theme with custom setting

New Member 帖子: 4 加入日期: 12-6-6 最近的帖子
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.


<theme id="deep-blue" name="Deep Blue"> 
	<settings> 
		<setting key="header-type" value="detailed" /> 
	</settings>
</theme>
<theme id="deep-blue-mini" name="Deep Blue Mini">
	<settings> 
		<setting key="header-type" value="brief" /> 
	</settings>
</theme>

#if ($theme.getSetting("header-type") == "detailed") 
    #parse ("$full_templates_path/header_detailed.vm") 
#else 
    #parse ("$full_templates_path/header_brief.vm") 
#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?
thumbnail
Namrata Hangal,修改在11 年前。

RE: Theme with custom setting

Regular Member 帖子: 161 加入日期: 10-7-27 最近的帖子
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,修改在11 年前。

RE: Theme with custom setting

New Member 帖子: 4 加入日期: 12-6-6 最近的帖子
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.
thumbnail
Muzakir Khan,修改在11 年前。

RE: Theme with custom setting

Regular Member 帖子: 112 加入日期: 12-3-15 最近的帖子
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.


<theme id="deep-blue" name="Deep Blue"> 
	<settings> 
		<setting key="header-type" value="detailed" /> 
	</settings>
</theme>
<theme id="deep-blue-mini" name="Deep Blue Mini">
	<settings> 
		<setting key="header-type" value="brief" /> 
	</settings>
</theme>

#if ($theme.getSetting("header-type") == "detailed") 
    #parse ("$full_templates_path/header_detailed.vm") 
#else 
    #parse ("$full_templates_path/header_brief.vm") 
#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..
S L B,修改在11 年前。

RE: Theme with custom setting

Junior Member 帖子: 25 加入日期: 08-7-28 最近的帖子
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,修改在11 年前。

RE: Theme with custom setting

Junior Member 帖子: 25 加入日期: 08-7-28 最近的帖子
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.