Skip to content. | Skip to navigation

Personal tools
Sections
You are here: Home wiki SlotDisplay

SlotDisplay

Allow (or not) Anonymous View of Navigation Portlet

Adapted from above, add a boolean property called allowAnonymousViewNavigation to portal_properties/site_properties

Make sure the property is unchecked.

Now, create and edit a custom navigation_tree_slot (go to /portal_skins/plone_portlets/portlet_navigation select customize and edit it - n.b. /portal_skins/plone_portlets/navigation_tree_slot has been deprecated) and look for the div tag that declares the portlet macro as follows:

 <div metal:define-macro="portlet">

 

In the above tag, add the following tal condition statement:

   tal:condition="python:test(not site_properties.allowAnonymousView
     and site_properties.portal_membership.isAnonymousUser(), 0, 1)"

 

Put the statement all on one line. Now you're done. If you change your mind, just check the allowAnonymousView "check box" that you created earlier in portal_properties/site_properties again.

Slot to display an image file.

Adapted from http://plone.org/documentation/how-to/random-photo-portlet. A Portlet is a Pagetemplate which contains a macro named portlet. Create a Pagetemplate named portlet_rndphoto in your custom Folder. Place the following code into it:

   <html xmlns:tal="http://xml.zope.org/namespaces/tal"
        xmlns:metal="http://xml.zope.org/namespaces/metal"
        i18n:domain="my-portlet">
    <body>
    <div metal:define-macro="portlet" 
    tal:condition="python:test(not site_properties.allowAnonymousView 
    and site_properties.portal_membership.isAnonymousUser(), 0, 1)">
      <div class="portlet" id="portlet-my-portlet"
      tal:on-error="nothing" >
          <h5 i18n:translate="box_my_portlet">Title of Image</h5>
          <div class="portletBody"  tal:on-error="nothing">
          <a href="http://www.met.ie/"><img src=/images/some_image.gif></a>
          Brief sentence or info.
        </div>
      </div>
     </div>

 

Next, go to the folder in your site you want the image portlet to display and add the portlet name to the left or right slots variable (n.b. will need to define if haven't already done so)