On Thu, Dec 05, 2002 at 01:33:03PM -0500, BZ wrote:
dtml-let section="_.string.split(_.string.lower(_.string.split(URL, '/')[3]), '.')"> <dtml-call "REQUEST.set('section', section)"> </dtml-let>
<dtml-if section>
<dtml-if "section=='folder_name'">
show new header
And this is the output and why it won't match which I think is because the first one is in a list. (??!)
['folder_name'] = folder_name
The ridiculously naive solution (since section is a one-item list) would be to use <dtml-if "section==['folder_name']"> but that's a bit silly. A slight improvement would be <dtml-call "REQUEST.set('section', section[0])"> Any better options would require more Python/DTML Zen than I have currently. But I'd think about making a Python Script called whichsection, with code something like: request = container.REQUEST url=string.lower(request.URL) section=string.split(url,'/')[3] print section return printed and then test <dtml-if "whichsection=='folder_name'">. I probably missed a split on '.', but none of my URLs have periods in them anyway. It took me quite a while to get in the habit of replacing DTML logic with Python Scripts, but it's *lots* more readable due to the less excessive punctuation (I don't even write Python code that often, and experimented my way to the above code by reading and converting your DTML-Python). -- Mike Renfro / R&D Engineer, Center for Manufacturing Research, 931 372-3601 / Tennessee Technological University -- renfro@tntech.edu