Question

I have a Plone (4.0.1) site which requires changes in layout depending on the folder. Imagine a structure like:

University > Faculty A > Institute A1 > Person A11
                                      > Person A12
                       > Institute A2 > Person A21
...

Now if I put all needed resources (custom css file, images, etc.) into the ZODB, pages for person A11 would automatically pick up a fac-image.gif located in the Faculty A folder.

However, to avoid confusion, I do not want to expose fac-image.gif to the users. (This is all part of the framework which they're not supposed to touch anyway.)

If I register a resource, I can access stuff with ++resource++theme.images/path, but no acquisition from parents is taking place, so ++resource++theme.images/facultyA/instituteA1/fac-image.gif won't find the image. Even worse, I have a separate directory structure to maintain now.

What I'm currently doing is hand-rolling a "best effort" traversal process through a file system directory view that will try to go down the path, just stay where it is if the subdirectory doesn't exist (i.e. the resource tree doesn't have a subdirectory for person A11; instead of yelling 404 I stay at institute A1), and then try to acquire back up. Some trickery is involved for portal_factory and views, and I'm pretty sure I've missed more.

So: that surely isn't the way one is supposed to do it, but what is?

Was it helpful?

Solution

You can inspirate you from collective.phantasy that implements this use case for plone3 (change l&f for a folder container).

OTHER TIPS

Use CSS.

Simply tag your tag with classes based on the current section / faculty / aspect of your choice and alter your images based on those classes. Keep visual design separate from your content!

It seems to be so. I ended up registering a helper view that examines and mangles the context path and points it somewhere else into a file system directory view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top