Randomize the portal logo
This HowTo describes how to randomly load different logos in place of the default Plone logo.
- Copy this from plone.css into your ploneCustom.css
#portal-logo { background: url(&dtml-portal_url;/&dtml-logoName;) no-repeat; border: 0; margin: 0.75em 0em 0.75em 1.5em; padding: 0; } - Create this Python script in your custom folder (I named it "logo").
from random import choice # logos folder logos_folder = "logos" # logo names go here all_logos = ['logo1.jpg', 'logo2.jpg', 'logo3.jpg'] # grab a random one logo = choice(all_logos) return logos_folder + "/" + logo
- change this line:
background: url(&dtml-portal_url;/&dtml-logoName;) no-repeat;into this line:background: url(&dtml-portal_url;/&dtml-logo;) no-repeat; - Do NOT mess with this part of plone.css:
#portal-logo a { display: block; text-decoration: none; overflow: hidden; border: 0; margin: 0; padding: 0; padding-top: <dtml-var "_[logoName].height">px; height: 0px !important; height /**/: <dtml-var "_[logoName].height">px; width: <dtml-var "_[logoName].width">px; cursor: pointer; } - For my site my logos are larger than the normal plone logo so I had to add in the following lines to my #portal-logo section in ploneCustom.css:
width: 329 px; height: 79 px; padding-bottom: 20px;
Thx to: Robert Hunter, and Chandrakantha Nagaraja
Have fun and if anyone knows why #4 messes everything up, please let me know.
-Paul

Spacing is an issue
To make this work, be sure to remove leading spaces if you cut and paste from the ploneCustom.css example above.
Also, while this is probably obvious, you must create a folder called 'logos' and populate it with logo1.jpg, logo2.jpg, etc. The image files you upload do not need to be JPGs. I used GIF images on my site, which are named logo1.jpg etc.