Okay, I think I´ve discovered how to use url_for

<div id="menu">
       % for url in c.links:
          <a href="${h.url_for('links', action=url)}" title="${url}"
class="level_menu">${url}</a><img src="img/menu_seperator.gif" alt="">
       % endfor
      </div>

I´m using Mako, so its use was not immediately clear.


On May 22, 6:38 am, voltron <[EMAIL PROTECTED]> wrote:
> @ Mike: Yes, almost right, it was a slash -behind- the generated link
> that I overlooked.
>
> @ Ben: I did not use h.url_for(), how would I apply it in this case?
>
> Thanks and sorry for being bothersome :-)
>
> On May 22, 3:29 am, Ben Bangert <[EMAIL PROTECTED]> wrote:
>
> > voltron wrote:
> > > ## MENU
> > > ====================================================================
> > >       <div id="menu">
> > >        % for url in c.links:
> > >             <a href="/${url.lower().replace(' ', '')}" title="${item}"
> > > class="level_menu">${item}</a><img src="img/menu_seperator.gif"
> > > alt="">
> > >        % endfor
> > >       </div>
>
> > > The problem with the capitalized first letter is gone. Maybe I should
> > > rephrase my question? I think I might be taking the wrong approach
>
> > > Given a list of main links and their subsequent sublinks
> > >  c.links = ["link1", "link2", "link3"]
>
> > >  c.link1_sublinks = ["link1_sub1", "link1_home_sub2", "link1_sub3"]
> > >  c.link2_sublinks = ["link2_sub1", "link2_home_sub1", "link2_sub3"]
> > >  c.link3_sublinks = ["link3_sub1", "link3_home_sub2", "link3_sub3"]
>
> > > how do I route the sublinks in the manner of:
>
> > > "link1/link1_sub1"
>
> > > or "link3/link1_sub2"
>
> > > I was thinking of creating controller for every main link, maybe the
> > > only solution?
>
> > How come you aren't using h.url_for? One of the big advantages of Routes
> > is that it can generate Routes as well, and it'll work even if you nest
> > your entire app under another app, or behind mod_proxy with a prefix. Or
> > is the use of that not in this snippet?
>
> > - 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