A good trick to look at is the breadcrumbs code which can be found at: http://code.google.com/p/tg-breadcrumbs/
Basically this digs a breadcrumb trail out of CherryPy and provides it as a list. To get this going: 1) download the breadcrumb.py and put it in your project folder. 2) import it in your root controller (and only your root controller). 3) adjust your master template to pick up the supplied list and display it. Point to note: Just importing breadcrumb.py (once) is enough for it to patch itself into TG so that it is called for every page. When I finally discovered this I thought it was amazingly neat and the sort of thing I intuitively knew ought to be possible but did not expect to actually find! Happy Hunting A On Jun 17, 12:26 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi all, > > Definitely a newbie problem: I would like to have a dynamical > header/footer on every page. I've looked > throughhttp://docs.turbogears.org/1.0/HeadersFootersbut what I don't get is > how I would pass the dict corresponding to the header/footer to the > template (that use extend/match, etc recommended by the above receipe) > automatically. What I would like to see is that in the methods of the > controller class I only need to return the dict corresponding to the > data specific to the page referenced by the given method and the dict > corresponding to the header/footer would be still visible for the > templates. In other words, my solution right now is update( )'ing > every single dict before it is returned by its method with the dict > containing data for the header/footer. This seems very redundant: > > header_footer = dict( .... header/footer stuff ..... ) > > class test( controllers.RootController ): > def page1( self ): > ................. # logic for page1 > out = dict( ..... ) > out.update( header_footer ) > return out > def page2( self ): > ................ # login for page2 > out = dict( ..... ) > out.update( header_footer ) > return out > > I'm aware of <?python ....... ?> that might do the trick but I don't > want to use that because then some part of the application logic goes > into the templates which I want to avoid. > > Any recommendations? > > Cheers, > Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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/turbogears?hl=en -~----------~----~----~----~------~----~------~--~---

