掲示板

Theme with custom setting

11年前 に Phill Ashworth によって更新されました。

Theme with custom setting

New Member 投稿: 4 参加年月日: 12/06/06 最新の投稿
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
11年前 に Namrata Hangal によって更新されました。

RE: Theme with custom setting

Regular Member 投稿: 161 参加年月日: 10/07/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
11年前 に Phill Ashworth によって更新されました。

RE: Theme with custom setting

New Member 投稿: 4 参加年月日: 12/06/06 最新の投稿
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
11年前 に Muzakir Khan によって更新されました。

RE: Theme with custom setting

Regular Member 投稿: 112 参加年月日: 12/03/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..

添付ファイル:

11年前 に S L B によって更新されました。

RE: Theme with custom setting

Junior Member 投稿: 25 参加年月日: 08/07/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.
11年前 に S L B によって更新されました。

RE: Theme with custom setting

Junior Member 投稿: 25 参加年月日: 08/07/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.