Welcome to Squishdot Websites Squishdot How-To
 post article
 Mailing Lists
 Bug Tracking


tricks with search method
Squishdot Posted by Bolik on Tuesday March 20, 02:14AM, 2001
from the is_this_smart_or_what? dept.

Passing search keywords in DTML, or another way to post some articles to some separate page.


I'm new to zope and very new to squishdot. I have somewhat unusual site setup, and while tweaking squishdot I've found the following:

dtml-call expr="REQUEST.set('subject',['cat','dog'])"

and then

dtml-var expr="search(REQUEST)"

from within any page in the squishdot site insterts the search results for subject: "cat" OR "dog" into that page. I've found it a blessing for what I am doing, but I want more.


I don't really understand what's going on, so please could somebody tell me why wouldn't it work with specifying the keywords in dtml-let, or dtml-with?

What else can be specified in this way? May be it IS possible to specify your own search result template in a similar manner?

<  |  >


Related Links
  • Articles on Squishdot
  • Also by Bolik
  • Contact author
  • The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Re: tricks with search method
    by Darrick Wong on Thursday March 22, 08:37PM, 2001

    Cool trick!

    First, a disclaimer: I haven't looked at Squishdot 1.0.0, so I'll only guarantee that this information is accurate for 0.7.x.

    The search functionality in Squishdot, if I remember correctly, is implemented in the Python sources, i.e. there's a function in Squishdot.py that pokes around the article index. Because it is a Python method, DTML variables are irrelevant--the Python code will never see it. After obtaining a set of results, the code then renders it in HTML with the showSearchResults DTML template and sends that back to the user.

    Yes, that call <dtml-var expr="search(REQUEST)"> is calling search() in Squishdot.py.

    Therefore, the only way to pass parameters to the search function is, as you describe, by filling in a REQUEST object and passing it.

    [ Reply to this ]
    Re: tricks with search method
    by Annette Loudon on Friday May 11, 04:34PM, 2001

    Cool trick. Thanks for the tip.

    I'm trying to use Squishdot as a content management tool for the articles and interviews section of a site. So I'm putting together methods that will display articles in a magazine style. Eg: One main news article with a photo, some summaries of articles from other section.

    I tried to tweak that code to just display the first article in a certain topic by adding size=1 to the dtml-in tag. but it doesn't seem to be working. This is the code I'm using:

    Can anyone tell me what I'm missing?

    For some context -- I'm not a programmer so I'm struggling with Zope in general. but so far i have managed to tweaked the output to look like a magazine by stripping out a bunch of stuff and displaying the attached graphic, etc. So I'm starting to get it.

    [ Reply to this ]
    • Re: tricks with search method
      by Annette Loudon on Friday May 11, 04:42PM, 2001
      arg. sorry about that. the code:

      <dtml-call "REQUEST.set('subject','Actualities')">
      <dtml-call "REQUEST.set('meta_type','Article')">
      <dtml-call "REQUEST.set('resultSet',this()(REQUEST=REQUEST,internal=1))">
      <dtml-in resultSet size=1 sort=id reverse>

      [ Reply to this ]

    The Fine Print: The following comments are owned by whoever posted them.
    ( Reply )

    Powered by Zope  Squishdot Powered
      "Any system that depends on reliability is unreliable." -- Nogg's Postulate
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©1999 Butch Landingin, ©2000-2002 Chris Withers.