[Zope] <dtml-in> tag in another <dtml-in> tag

Thomas B. Passin tpassin@mitretek.org
Tue, 7 May 2002 16:51:18 -0400


[Leo]

> Hello, I have a problem to assign a variable in the dtml-in tag.
>
You certainly have if you think that's what you are doing in yuour code
fragment below.

> If I use the following code, I can get the expected result.
>
> <dtml-in "test('/temp/1063')">
>      <a href="description_html?file=/temp/<dtml-in
Inspector_Name><dtml-var UserID></dtml-in>/<dtml-var
sequence-item>"><dtml-var sequence-item><br>
> </dtml-in>
>

You are trying to write a collection of html "a" elements, not assign any
variables.  Now, setting that aside, if this is the only code it is
mal-formed because there are more </dtml-in> than <dtml-in> tags.

You need to start with what you want to accomplish, and then make sure all
the pieces work right.  For example, dtml-in will loop through the database
result set.  Is that what you want?

If it is, then does Inspector_Name work as expected?  And so on.  If you
know what works and what does not, make sure you include the information
when you ask for help.

Once all the parts work, try something as simple as possible, and extend it
until you encounter a failure.

In this case, we don't know if there is an outer dtml-in loop, so it's hard
to know wht to say.

> However, I want to get 1063 in line 1 from <dtml-in
Inspector_Name><dtml-var UserID></dtml-in>, just like line 2, I failed.
> "Inspector_Name" is a ZSQL-method, to retrieve the UserID from the
database by using the login name.
> "test(path)" is the external method to get the actual files name and
directories name in the ext2 file system of Linux.
>
> I tried to use <dtml-in "test('/temp/<dtml-in Inspector_Name><dtml-var
UserID></dtml-in>')"> instead of line 1. I failed.
>

Of course.  You can't embed one dtml tag in another, and there is never any
reason to try.  Once you are inside a dtml element, the Zope variables and
properties are available - you don't need to open another tag to get at
them.

Cheers,

Tom P