George Hartzell wrote:
I'm redoing an existing app as a CGI::Application using Template Toolkit.In my mason version I did a set of tabs across the top of the page be defining an <ul></ul> and using css to style them into tabs. The current tab was made to stand out by styling it with a different css class (called "current"). I used the same template on all of my pages by declaring a filter block that figured out the url of the current page then fixing up the anchor that contained an href to that page so that it was in the "current" class. Here's the filter: <%filter>; (my $url = $r->uri) =~ s/index\.html$//;s{href="$url"}{href="$url" class="current"}g; </%filter> In my TT page I can get the url with this: [% c.query.self_url %] and I can use a big [% FILTER replace('href="/toplevel"', 'href="/toplevel" class="current"') %] [% END %] to do the right thing for a hardcoded tab. I haven't figured out the right way to get it to happen for arbitrary pages. Does anyone have a good Template Toolkit-ish version of this trick? Thanks, g.
I would like to know a good solution as well. I was pondering this at work the other day. I currently have a lib file and in that file I have named blocks [% BLOCK pagename %] and I use that to give myself different tabs for the current page.
Robert --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
