These notes are from my work on a Plone 3 site that has many students and teachers as users. All users are allowed to create content and share it with other users.

I needed to have a portlet that would only be displayed when users are in their "My Folder" area and viewing the "Sharing" tab. This portlet would have a link to a "Sharing Help" page. We needed a "Sharing Help" page because the "Sharing" tab doesn't contain much in the way of help for untrained users like the ones we have on this site. The "Sharing Help" page is located in a folder called "resources" that is in the root of the site.

The key line for making the portlet appear only when users are viewing the "Sharing" tab is this:

tal:condition="python:request.URL.find('@@sharing') != -1"

 

You can replace the '@@sharing' part with whatever you'd like. Maybe you want a portlet to show up only if part of your URL was 'testing.' or whatever.

This post is mostly a note to myself in case I need to do this again, but I hope it's useful to others as well.

Here's the code for the entire TAL portlet:

<dl class="portlet portlet${portlet_type_name}"
    tal:condition="python:request.URL.find('@@sharing') != -1"
    tal:define="portal_state context/@@plone_portal_state;
                context_state context/@@plone_context_state;
                portal_url context/portal_url;">

    <dt class="portletHeader">
        <span class="portletTopLeft"></span>
        <span>
           Sharing Help
        </span>
        <span class="portletTopRight"></span>
    </dt>

    <dd class="portletItem odd">
      <strong>
      <a href="#"
        tal:attributes="href string:${portal_url}/resources/sharing-help">
        Click here for help with the "Sharing" tab.
      </a>
      </strong>
    </dd>
    
    <dd class="portletFooter">
        <span class="portletBotomLeft"></span>
        <span>
        </span>
        <span class="portletBottomRight"></span>
    </dd>

</dl>
Document Actions