> >Again an undoubtedly newbie question: what's the best approach for > >managing small html fragments that are used by several pages in > >several places, maybe several times in a given page? > > > > > There's two main approaches. You could use template functions, something > like: > > <p py:def="myfunc"> > ...stuff... > </p> > > You can put them either in their own file, or perhaps in master.kid. > > The other approach is to make them widgets. Something like (in a .py file): > > class MyWidget(Widget): > template = "....." > ... > > Myself, I tend to make things widgets. This is definitely preferable if > you have complex Python code to go with them. It also gives you the > ability to specify javascript/css resources, that will be included in > the appropriate part of the page.
Thanks very much, widgets are the things I was looking for. Actually, this document, http://docs.turbogears.org/1.0/IntroductionToWidgets explains them quite well, I just didn't know the terminology :) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

