Forums / Developer / Match conditions for override templates

Match conditions for override templates

Author Message

Gwenal Le Bihan

Friday 09 March 2007 4:27:13 am

Hello everybody,

I can not find anything related to that matter.

Is it possible to override templates for an object A depending on what object B or C is "reversed related" to A (content/view/xxx).
Ex: B is "calling" A so I have a template for that but when C is "calling" A I'd like another template but for the same view, and of course class.

I was thinking of a section but it requires a double placement for A and that's not really convenient...

Is there a way to do that in a simpler way because I can't find any override conditions that match that purpose.

Thanks to who might help...

Gwenal

Kristian Hole

Friday 09 March 2007 9:11:58 am

Hi,

The possible override-conditions for each template is listed here:

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_override_conditions

Unfortunately there is no rules that allows you to do what you describe. What are you trying to do? I am sure there is a better way of implementing what you want to do :-)

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Gwenal Le Bihan

Wednesday 14 March 2007 7:31:30 am

Hello and thx for the reply.

It is related to the newsletter extension that works fine with me but to make it simpler for the administrator, I let him create a special "newsletter" object where he can relate objects that already exists in his site (articles...) the problem is that I need to generate a full path for the images to be shown so it's a different set of templates for image.tpl or ezimage.tpl...

My problem is the override conditions I should use...
I was thinking of Match[section] and some /content/view/full override conditions but it would mean that my images are also in that section which is not the case.

I know i can compose my news in my "newsletter" object but it's just to make it easier to use for the administrator.

... unless the new templates are used everywhere (it works but it's a bit "dirty")....

So my problem is related to newsletter but it can be seen in a wider approach...

I hope I made myself clearer ;-)

Gwenal

Kristian Hole

Thursday 15 March 2007 9:19:00 am

Ok, i understand now.

I think what i would do, is to use a special override for the "newsletter" object where you instead of doing

{foreah $related_objects as $related_object}
{node_view_gui view=full content_node=$related_object}
{/foreah
 

you can use:
view=mynewsletter

So eZ Publish will load node/view/mynewsletter.tpl, and you can make overrides for that instead. In this case you should be able to do what you want. :-)

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Gwenal Le Bihan

Tuesday 03 April 2007 7:32:08 am

Thanks a lot, I think it'll do...
been away for a while!