[triangle-zpug] Placeful Plone skins

Jim Allman jim at ibang.com
Wed Dec 22 17:33:50 CET 2004


Just found another interesting option for context-sensitive 
skin-switching in Plone. There's apparently a hook for a 'setSkin' 
method (defined in a Python script). This can assert a skin for every 
page request, based on whatever logic you like. For example:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
. . . . . . . . . . . . . . .
##title=Skin changing script
##parameters=
req = context.REQUEST
if req['SERVER_URL'].find('internal.somesite.org') > -1:
     context.changeSkin("Plone Default")
context.changeSkin("Custom Chrome")
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
. . . . . . . . . . . . . . .

So you might pivot skins based on URL components, authenticated vs. 
anonymous users, a saved user preference, or the phase of the moon. 
Spiffy! This is kind of an all-or-nothing switch, but perhaps you could 
also tweak individual values as in Chris' 'logo_name' example (maybe 
stuff a value into REQUEST?).

More details in the online Plone guide (just search this page for 
'setSkin'):
	http://his.biologie.hu-berlin.de/PloneBook/ch7.rst

   =jimA=

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 
. . . . . . . . . . . . . . .
Jim Allman
Interrobang Digital Media
http://www.ibang.com/
(919) 649-5760




More information about the triangle-zpug mailing list