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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -