Hi, On 05/09/2010 07:46 AM, [email protected] wrote: > We have several objects that share parts of their schemata. (In our local > terminology we call them "modules" because users were confusing them with > portlets.) The tal for these modules is the same for every object. (For > example there's a multimedia block that displays videos, flickr photosets, > and images.) That tal has gotten to about 200 lines and resides in five or > six different template files. I'm looking for a way to not have to copy-paste > the tal into each template any time it changes. > > One thought I had would be to use a viewlet, but I'm not sure if that's the > best solution, or even what steps I should take to make the viewlet aware of > the context of the content object (or at least the fields I need) being > viewed.
What's wrong with this? I suppose you have to show data from the context (aka the object you are displaying). You can define a viewlet-manager per viewlet in order to be more flexible and call single viewlets at time. Anyway, you can use also a simple macro or a set of macros. If you look at "base_edit.pt" (which is used for every AT object) you will see that there's almost no code but many calls to macros such as "header" "body" and so on. HTH, SimO _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
