Thanks Ben, but I have two other questions:

How do I make this work for sublinks?

# my route
map.connect('sublink2', '/link2/sublink2', controller='home',
action='sublink2')


The second question is, how do I pass tag attributes to link_to ?





On Jun 2, 6:37 pm, Ben Bangert <[EMAIL PROTECTED]> wrote:
> On Jun 2, 2007, at 8:29 AM, voltron wrote:
>
> > I´m generating links with a loop and url_for(), sadly , this does not
> > work:
>
> > # c.links is a list
>
> > % for url in c.links:
> >      <a href="h.url_for(${url}">${url}</a>
> > % endfor
>
> > I get a traceback with encoding errors
>
> > What would be the right way to do this?
>
> h.url_for is a Python function, so it needs to be in the ${} like so:
>
> % for url in c.links:
>      ${ h.link_to(url, h.url_for(url)) }
> % endfor
>
> That should do the trick.
>
> Cheers,
> Ben


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to