[Zope] DMTL-IF: Listing Documents that contain queryword (Solution)

Marc Lindahl marc at bowery.com
Mon Nov 24 14:14:08 EST 2003


If you look in CMF at the folder_contents.pt skin, it does something  
similar based on object attributes (like folderish) that can give you  
an idea how to selectively display content (even if you're not using  
CMF it's still a nice example).  Bite the bullet and do it with TAL :)

On Monday, November 24, 2003, at 10:08  AM, Sean Lee wrote:

> Thanks to folks who responded to my question (as in Subject),  
> especially
> Jonathan and Dylan.
> I've been trying to DMTL my way through this, on and off, for several
> weeks.
>
> Simply speaking, I have a bunch of files in a directory and I want to
> (automatically) create URLs that will list groups of files by title so
> that all files "Category A*" are listed together.
>
> I decided to try the way of ZCatalog (hint provided by Jonathan, Small
> Business Services) first and it proved to work "as seen on the Web".
>
> Here are the steps I've done to get it working - it's easy, but I
> couldn't find any how-to's on this so here's a mini how-to, I hope
> others will be able to find it in archives when needed.
>
> 1. ZCatalog
> The relevant doc for v2.6 are here
> http://zope.org/Documentation/Books/ZopeBook/2_6Edition/ 
> SearchingZCatalog.stx
> (I use Zope 2.5.x)
> So, I found the Web docs very confusing so I just tried intuitively -
> added ZCatalog, went to its Find Objects tab, catalogued all objects in
> a directory/folder
> Then I created a pair of forms (Search/Results) by adding ZSearch
> Interface. I tried searching for *keyword* in Title, it worked.
>
> 2. Search Form
> To be able to search "*keyword*" (in title, in my case) in an easier  
> way
> (without having to enter the asterisks), you can simplify the default
> search form to something like this:
>
> <form action="categories.html" method="POST">
> <p>Select files of type:
> <select name="title">
>      <option value="*Category A*" selected>List Category A</option>
>      <option value="*Category B*" selected>List Category B</option>
> </select>
> <p><input type="submit"></p>
> </form>
>
> 3. Results Form
> If necessary, modify the default search results form to list URLs to
> files.
>
> 4. Further improvements
> If you want to combine steps 2 & 3 into one page, refer to
> http://www.devshed.com/Server_Side/Zope/ZopeForm/page6.html
> Instead of his <dtml-if submit>, I have <dtml-if title>, also for
> the dtml-else tag.
>
> Again, thanks to those who helped..
>
> Cheers
> Sean
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )




More information about the Zope mailing list