Patrick Ulmer wrote:
Hi,
I want to do something like that:
<dtml-if id_historie> <dtml-in expr="dbSelect(id_historie=_.str(id_historie))"> <dtml-else> <dtml-in expr="dbSelect(id_historie=_.str(0))"> <dtml-if>
[...]
</dtml-in>
but I get the error " unexpected end tag, for tag </dtml-in>". How can I query my database depending on having id_historie defined or not? Can somebody give me a hint?
You can't put <dtml-in> in a dtml-if. You must include the </dtml-in>. This is because <dtml-in> and <dtml-if>, and all other dtml-tag that comes in pairs, defines a DTML block in between them and you can't have overlaping blaocks. When the DTML "page" is rendered the DTML blocks are executed as a whole with it's local context. In the exaple above I would set id_historie in a <dtml-let> tag: <dtml-let id_historie="id_historie or 0"> <dtml-in expr="dbSelect(id_historie=_.str(id_historie))"> ... </dtml-in> </dtml-let> Best Regards, Johan Carlsson -- Johan Carlsson Tel: + 46 8 31 24 94 Colliberty Mob: + 46 70 558 25 24 Torsgatan 72 Email: johanc@easypublisher.com SE-113 37 STOCKHOLM