Fórumok

Theme with custom setting

Phill Ashworth, módosítva 11 év-val korábban

Theme with custom setting

New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.06.06. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Theme with custom setting

Regular Member Bejegyzések: 161 Csatlakozás dátuma: 2010.07.27. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Theme with custom setting

New Member Bejegyzések: 4 Csatlakozás dátuma: 2012.06.06. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Theme with custom setting

Regular Member Bejegyzések: 112 Csatlakozás dátuma: 2012.03.15. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Theme with custom setting

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2008.07.28. Legújabb bejegyzések
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, módosítva 11 év-val korábban

RE: Theme with custom setting

Junior Member Bejegyzések: 25 Csatlakozás dátuma: 2008.07.28. Legújabb bejegyzések
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.