[ZPT] building a href in zpt

Tino Wildenhain tino at wildenhain.de
Fri Jun 17 03:53:33 EDT 2005


Am Freitag, den 17.06.2005, 12:05 +0530 schrieb Kenneth Gonsalves:
> hi,
> i have a postgres table like so:
> 
> id integer
> name varchar
> 
> i want to list the contents of the table and build an href like this:
> 
> <a href="foo.bar.com/edit?id=someid">name</a>
           ^^^^
_never_ write URLs like this. When you write
server name, you have to write http:// schema
too. Else it is indistinguishable from folder
names.

> 
> my zpt code so far is:
> 
> <a tal:attributes="href string:${portal_url}/editdemo?="
>  tal:content="result/name">name</a>
> 
> but i cant figure out how to insert the tal:contern="result/id" after 
> the '?='
> 
> any clues?

Where does result/id come from?
If you use a python script, its quite easy to

from ZTUtils import make_query

and where you need it in your routine:

result['href']=portal_url+'/editdemo?'+make_query(id=valueforid)

...

and in your ZPT you just use tal:attributes="href result/href"


-- 
Tino Wildenhain <tino at wildenhain.de>



More information about the ZPT mailing list