> > I will define a standard menu of first-level pages, but when those pages
> > are visited have a sub-menu displayed for that page.  The small twist would
> > be that I'd like to be able to automatically generate that sub-menu from,
> > say, <h2> tags within that page (so people that don't know TT at all could
> > still work with the content).
> 
> Interesting idea.
> 
> You could write your main layout template like this:
> 
>   [% WRAPPER html/page;
>        content = PROCESS $template FILTER my_submenu_filter;
>        PROCESS menu;
>        content;
>      END
>   %]
> 
> 
> Your 'my_submenu_filter' could search through the output generated by 
> PROCESSing the main $template and build a menu structure from the 
> <h1>...<h1>, <h2>...</h2> elements, and so on.   You could stuff this 
> info in [% global.submenu %] and then access it from the menu component,
> doing something like this:
> 
How can a filter set global template variables? Are there other
parameters to the filter routine than just the text which is about
to be filtered?

I'd guess this needs a dynamic filter which is difficult (if at all
possible?!) to create with "plain" ttree - or what am I missing?

I am using ttree for a similar problem (the input pages contain
non-TT texts which need to be parsed and filtered) and I am
using a plugin for that job. Let me suppress details for the
moment because I am likely to drop my solution after someone
tells me how to use own filters with ttree :-)
-- 
Cheers,
haj



Reply via email to