"James W. Howe" <jwh@allencreek.com> wrote:
I've got a folder which contains DTMLMethods which are used to format a "news" article in a certain way. One of the methods is responsible for actually displaying the article contents, the others are responsible for generating various navigational components. I'm now designing a new view which is also going to display a news article, plus some other stuff. The major difference is that this view is only going to show a subset of information. I would like to reuse the article display code but I'm not exactly sure how to do it. What I would like to do is retrieve the first N characters from a news article and then have my method format it. Something like:
<dtml-var "formattingMethod(???, <dtml-var articleContent size=500>)">
I'm not fluent enough in all the nuances of how you call a DTMLMethod rather than get results via reference/acquisition. I suppose I could pass the length restriction as a parameter and if that parameter didn't exist the full article would be retrieved. I would rather simply pass the article contents and let the method format what it is given.
Any help would be appreciated.
See ZGotW #1 :) Calling one DTML Method from within another requires passing through two "required" parameters, one for the "client" object and one for the namespace. So, to just call it: <dtml-var "formattingMethod(???, articleContent( this(), _ ) )"> You can then use the majyk of Python to slice off the first 500 characters: <dtml-var "formattingMethod(???, articleContent( this(), _ )[:500] )"> -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
participants (1)
-
Tres Seaver