[Zope] DTML Question

Passin, Tom tpassin@mitretek.org
Tue, 14 Jan 2003 18:12:41 -0500


[ beno]

> >[ beno]
> > > I know one cannot nest DTML objects, but the below lets you know=20
> > > what I'm trying to accomplish. What is the correct syntax?
> > >
> > > <dtml-let folder=3D"<dtml-var id>">
> > >
> >
> ><dtml-let folder=3Did>
>=20
> That simple. Thanks. But I'm still not home free. Here's my code:
>=20
> <dtml-let lang=3D"REQUEST.get('HTTP_ACCEPT_LANGUAGE')">
>   <dtml-in objectValues>
>    <dtml-let folder=3Did>
>     <dtml-if expr=3D"folder[2:]=3D=3Dlang[2:]">
>      <dtml-call "REQUEST.set('approved', '[lang]')">
>      <dtml-var approved>
>     </dtml-if>
>    </dtml-let>
>   </dtml-in>
> </dtml-let>
>=20
> It prints this: *[lang]*. I need it to print the value of the=20
> variable. How=20
> do I do that?

Sure, '[lang]' is just a string, so that is what it prints.  The
variable you created is lang, so you just write=20

<dtml-call "REQUEST.set('approved', lang)">

BTW, I would simplify (just shorter and easier to read, not otherwise
better) these lines:

<dtml-let lang=3D"REQUEST.get('HTTP_ACCEPT_LANGUAGE')">
<dtml-if expr=3D"folder[2:]=3D=3Dlang[2:]">

to

<dtml-let lang=3D"REQUEST['HTTP_ACCEPT_LANGUAGE']">
<dtml-if "folder[2:]=3D=3Dlang[2:]">

Cheers,

Tom P