Tuesday, January 12, 2010

Randomizing Logos in Plone 3.2.3

It has been a while since my last post. I have been swamped with trying to get things ready for the upcoming school year. Plus, it is summer in Okoboji.



Anyway, I thought I should post this little tid bit regarding randomizing logos in Plone 3.2.3. It does not work the way it used to in this original post from Plone 2.x. However, you can use the script from step 2 of that post and edit the logo.pt file to get it to work. So follow step 2 of that post and then edit the logo.pt file from the ZMI inside your Plone instance under /portal_view_customizations/plone.logo to call that script instead of the img tag that is there. Below is what my edited version looks like.


<a metal:define-macro="portal_logo"


id="portal-logo"

accesskey="1"

tal:attributes="href view/navigation_root_url"

i18n:domain="plone">

<img tal:attributes="src context/logo" />

</a>




I also wanted my logos to show different sets of logos depending on what section of the website the user is in (i.e. when in the middle school section the user sees middle school related logos). So, I added a logo folder to each section of the website containing the appropriate number of logos to satisfy the script (in my case 15 for each section). Zope/Plone looks for the closest instance of the resource (i.e. the logo folder) based on where the script is called from. It's nice like that.



If you just want one folder with logos for your entire site you would just put one logo folder in the main folder of your Plone instance.



I hope this can help someone save some time searching. I would like to thank the original poster, Paul Hartzog, and pigeonflight from IRC #Plone for their know how.

No comments:

Post a Comment