I have several DTML-Methods that simply hold page Fragments. In my main DTML Document I want to include one of these Methods via the <dtml-var> tag. If I use the method's name it works, the HTML source is included in the document and displayed correctly. But unfortunately, the method's id is stored in a variable (pagename). if I put <dtml-var pagename> or <dtml-var "pagename"> only the the method's id is displayed, not the contents/results of the method call. I've tried all combinations that came to my mind, but none worked. How can I solve this? -- Heiko Stoermer MIG Augsburg
At 16:09 31/08/99 , Heiko Stoermer wrote:
I have several DTML-Methods that simply hold page Fragments. In my main DTML Document I want to include one of these Methods via the <dtml-var> tag. If I use the method's name it works, the HTML source is included in the document and displayed correctly. But unfortunately, the method's id is stored in a variable (pagename). if I put <dtml-var pagename> or <dtml-var "pagename"> only the the method's id is displayed, not the contents/results of the method call. I've tried all combinations that came to my mind, but none worked.
How can I solve this?
You should use inderection: <dtml-var "_[pagename"]> will include the literal content of the object named by the pagename variable, and quote any HTML in it. If yo uwant it to be called, (like the <DTML-var objectname> or <dtml-var name=objectname> syntax does), use this: <dtml-var "_.getitem(pagename, 1)"> See the DTML Users Guide, and look at the 'name' and 'expr' attributes, and the _ object. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------
Martijn Pieters wrote:
If yo uwant it to be called, (like the <DTML-var objectname> or <dtml-var name=objectname> syntax does), use this:
<dtml-var "_.getitem(pagename, 1)">
ha! that worked. thanks a lot for the fast reply. I really got stuck because of this. Regards, Heiko -- Heiko Stoermer MIG Augsburg
Here's a whirlwind tour of object access: Suppose you have a variable 'halfabee' containing the string 'eric'. Then all of the following will render the Method 'eric': <dtml-var eric> (or <dtml-var name=eric> <dtml-var "eric(this(), REQUEST)"> (or <dtml-var expr="eric(this(), REQUEST)">) <dtml-var "_['eric']"> <dtml-var "_[halfabee]"> Now, if to get to 'eric' you need to go through 'sketch' and 'singing' first, you could surround any of the above like so: <dtml-with sketch><dtml-with singing><dtml-var "_[halfabee]"></dtml-with></dtml-with> <dtml-with "sketch.singing"><dtml-var "_[halfabee]"></dtml-with> or just write: <dtml-var "_.getattr(sketch.singing, halfabee)(this(), REQUEST)"> ----- Original Message ----- From: Heiko Stoermer <heiko@mig.net>
I have several DTML-Methods that simply hold page Fragments. In my main DTML Document I want to include one of these Methods via the <dtml-var> tag. If I use the method's name it works, the HTML source is included in the document and displayed correctly. But unfortunately, the method's id is stored in a variable (pagename).
participants (3)
-
Evan Simpson -
Heiko Stoermer -
Martijn Pieters