Getting content from a smart folder into a portlet

I haven’t seen a tutorial on how to get content from a smart folder into a portlet but as far as I can see the trick is just to use queryCatalog(full_objects=’true’) on the smart folder where you would have used getFolderContents().

<html xmlns:tal="http://xml.zope.org/namespaces/tal&quot;
      xmlns:metal="http://xml.zope.org/namespaces/metal&quot;
      i18n:domain="plone">

<body>

<!– The smart folder portlet  –>

<div metal:define-macro="portlet" tal:omit-tag=""
     tal:define="results python:here.mysmartfolder.queryCatalog(full_objects=’true’);"
tal:condition="results">              

     
         <div class="portlet" id="portlet-smartfolder">
        <h5>Smart folder</h5>
           <tal:block repeat="obj results">
                <br />
                <p><strong tal:content="python:test(obj.Title, obj.Title(), obj.getId())"> Title </strong><br />
                <span tal:replace="structure obj/Description">Description</span>
                <br />
                <a xhref="" i18n:translate="read_more" tal:attributes="href obj/absolute_url">Read More</a>
                <br /></p>
           </tal:block>
    </div>

</div>

</body>

</html>

 

 

technorati tags: , ,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s