[Zope] using smart folder to pick certain number of news articles to display in the home page

Thomas Bennett bennetttm at appstate.edu
Mon Jul 2 09:21:14 EDT 2007


See:  http://www.zope.org/Members/EIONET/RDFSummary  This product is old but I 
don't think it needs any maintenance since it still does the simple but good 
job it was designed to do.

I have a different situation but you might want to implement this.  This is 
with just Zope not Plone.  All our news articles are in CoreBlog, you would 
use CoreBlog2 for Plone, unless I'm not mistaken SmartFolders has support for 
RSS included.

   CoreBlog has built in support for RSS feeds of articles. Using RDFSummary I 
run a nightly cron job, which now can be done with clock server, to call the 
update function in RDFSummary.  The RDFSummary is set to grab the newest four 
entries with each update.  I expect you would have to choose a different 
number of entries and then parse it or through some other method find the 
results of your search of the RSS results.

Of course you would need to replace with proper syntax for Plone since my site 
is just Zope.  rssnews_headlines is the id of my RDFSummary.

<dtml-with rssnews_headlines>
   <div id="rss">
     <dtml-in items mapping>
       <li><a href="<dtml-var link>" target="new"><dtml-var title></a></li> 
       <br />
     </dtml-in>
   </div>
</dtml-with>

Example from the RDFSummary Product page, dtml and then ZPT example.
<dtml-with slashdot>
  <dtml-var "channel()['title']">
  <dtml-var picture>
  <dtml-in items mapping>
    <p>
    <a href="<dtml-var link>">
    <dtml-var title></a><br>
    <dtml-if "_.has_key('description')">
      <dtml-var description>
    </dtml-if>
    </p>
  </dtml-in>
</dtml-with>

or if you prefer ZPT: 
<metal:block tal:condition="here/slashdot"
	     tal:define="news here/slashdot">
   <div tal:content="python:news.channel()['title']" />
   <div tal:repeat="item news/items">
       <a href=""
          tal:attributes="href item/link"
          tal:content="item/title"
       />
   </div>
   <div>
       <a href=""
          tal:attributes="href python:news.channel()['link']">More ...</a>
   </div>
</metal:block>


Results may be seen on http://www.library.appstate.edu/ at the bottom center 
of the page under Library News:.

Click on the view tab of the RDFSummary to see all of the available fields 
that may be included in your page.  You may also want to look at RDFGrabber

Thomas

On Saturday 30 June 2007 09:56, kamal hamzat wrote:
> Hello All,
>
> I have folders containing the news articles, I have created a smart folder
> in the root that allows me to display these articles in the homepage of my
> website. How can I can I set up the smart folder so that just the first two
> articles that matched my criteria from each folder are display in the home
> page.
>
> Thanks.
>
> Kamal

-- 
====================================================================
Thomas McMillan Grant Bennett		Appalachian State University
Operations & Systems Analyst		P O Box 32026
University Library				Boone, North Carolina 28608
(828) 262 6587

They say a picture is worth a thousand words.  As videos could be 25 pictures 
per second and might last several minutes, how many words is that? 
- Linux Journal, July 2007

Library Systems Help Desk: http://www.library.appstate.edu/help/
====================================================================


More information about the Zope mailing list