Personal tools
You are here: Home Documentation Tutorials Switching Skins Making a Skin Switch Last
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Making a Skin Switch Last

How to make a skin switch last beyond a single REQUEST and page view.

George Lee

This Tutorial describes how Plone chooses a skin when you open a web page, and then describes the multiple ways that you can intervene to switch the skin. The Tutorial also discusses two common use cases, switching skins based on URL and the type of user (e.g., Anonymous or Authenticated).
Page 4 of 8.

Because Plone determines the current skin on every page load, we need to make sure that any changes we make last.


Two of the above interventions are standard ways of changing underlying settings, ensuring that the skin switch lasts:

  • (2B.i) Use the ZMI to enable changing users' skin preferences. Then use the Plone personal preferences page to change a user's preferred skin, and thus automatically create a cookie with the skin name.
  • (3) Use the ZMI to change the default skin.


Two of the interventions involve changing underlying settings, but not in a standard way.

  • (2B.ii) Set a user's preferred skin outside of the preferences form, and update the cookie.
  • (2B.iii) Create a portal_skins cookie manually.

To do this, you should create a one-time script.


Finally, three of the interventions only make short-term changes that only last for the short lifetime of a single REQUEST:

  • (1A) Call object.changeSkin('mySkin').
  • (1B) Manually modify the SKINDATA variable.
  • (2B) Add 'portal_skin' to the REQUEST as a simple string attribute.

To make these changes sustainable, you must use a script that repeats on every page load. The typical way of doing this is using an Access Rule. See EnSimpleStaging Tutorial - Switching Skins By URL and Using Zope/Apache to Switch Skins By URL for examples of how to do this.

 
by George Lee last modified October 21, 2006 - 19:59 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by