[ZPT] URL query string variables to call a macro or template

KJ Moffatt, Careers Advisory Service Keir.Moffatt at bristol.ac.uk
Wed Sep 15 09:51:42 EDT 2004


Hi all,

I want to use the url query string variables (e.g. 
index_html?id=book1&page=19) to call a macro or template.

## Example Page Template code

<!-- Example query string is ?include=test&name=testname -->

<div tal:define="incfile request/include; incname request/name">
<h2>The macro you are using is: <b tal:content="string: 
$incname">macroname</b></h2>

<!-- Then I want to call the macro using the $incname variable so
     rather than use=macro="here/test/macros/testname"
     I'd like to use the following: -->

<div metal:use-macro="here/$incfile/macros/$incname">footer</div>

</div>

## Code ends

The above obviously does not work for me but I have been told that:

1. I could use tal:replace="python:path('here/' + incfile ....
2. It may not be possible with metal.

PLEASE can someone help as this has had me stumped for ages.

Thanks for your time,

Keir



More information about the ZPT mailing list