plone - Reuse the same template for different content types -


i'm creating quite few dexterity content types (thanks zopeskel.dexterity devs!!) if need them different content types (searches, collections...), of them rendered equally.

so, there's way reuse same template different content types?

ok, made work i'm wondering if it's correct approach:

from my.product.parent_type import iparenttype, parenttype, twocolumnsview  ... code omitted ...  # common folder templates grok.templatedir('parent_type_templates')  class sametwocolumnsview(twocolumnsview):     grok.context(customclass)     grok.require('zope2.view')      grok.template("twocolumnsview") 

any thought? how reuse templates across content types?

create interface this:

from zope.interface import interface  class itwocolumnviewable(interface):     """can viewed in 2-column layout""" 

you assign interface various content types, , register view interface instead directly type:

class sametwocolumnsview(twocolumnsview):     grok.context(itwocolumnviewable) 

Comments

Popular posts from this blog

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -