[Product-Developers] Regisering Viewlets Without a Theme

David Glick davidglick at onenw.org
Wed Oct 1 16:14:45 UTC 2008


Nathan,
You should assign (in ZCML) your viewlet to a browser layer that is  
installed by the product in which your viewlet code appears.  This is  
subtly different from theme browser layers (the latter are implemented  
in plone.theme and add a marker interface to the request based on what  
theme is active, whereas the layers I'm talking about are implemented  
in plone.browserlayer and add a marker interface to the request based  
on the presence of a local utility).

The README.txt in plone.browserlayer should get you going...

David

On Oct 1, 2008, at 8:42 AM, Nathan Van Gheem wrote:

> Hello,
>
>     I am having issues with trying to register viewlets without a  
> theme.  From what I can tell, it is designed that you register a  
> viewlet with a theme product through a skin/layer.  Problem here is  
> that you can only choose one theme at a time, so if you want a theme  
> installed besides your viewlet, it will not work.
>
>     If you do not register it with a theme, you can just leave out  
> the layer declaration for the viewlet.  According to the zope docs,  
> this give the viewlet the default layer.  Problem here is that the  
> viewlet will show up in sites that do not even have the product  
> installed.  This didn't make much sense to me, because I thought  
> that plone would only register the viewlet for itself once it read  
> the Generic Setup information to place the viewlets.  I guessing the  
> zope viewlet architecture is superceding the plone implementation of  
> it here...
>
>     The solution I've come up with thus far is just check if the  
> viewlet is installed, and only render it if it is.  This is ugly and  
> should be unnecessary.
>
>     I've been banging my head on the wall about this for some time  
> now.  It really annoys me that this can't be done easier.  Is this a  
> shortcoming of viewlets or is there a tricky way to get this to work  
> correctly?
>
>
> Thanks,
>
> Nathan
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers

David Glick
Web Developer
ONE/Northwest

New tools and strategies for engaging people in protecting the  
environment

http://www.onenw.org
davidglick at onenw.org
work: (206) 286-1235 x32
mobile: (206) 679-3833

Subscribe to ONEList, our email newsletter!
Practical advice for effective online engagement
http://www.onenw.org/full_signup




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20081001/6d75370b/attachment.html>


More information about the Product-Developers mailing list