[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgiapp
Subject:    [cgiapp]  Re: TT version of mason metaphor (tabs along top of page)?
From:       Robert Hicks <sigzero () gmail ! com>
Date:       2006-10-16 0:17:07
Message-ID: eguj22$8b5$1 () sea ! gmane ! org
[Download RAW message or body]

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/cgiapp@lists.erlbaum.net/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@lists.erlbaum.net
For additional commands, e-mail: cgiapp-help@lists.erlbaum.net

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic