Hi,

>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.

Hope this helps,

Paul

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to