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!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 11:05:45
Script start
Timing: Jan 18 2025 11:05:45
Module start 'layout'
Timing: Jan 18 2025 11:05:45
Module start 'content'
Timing: Jan 18 2025 11:05:45
Module end 'content'
Timing: Jan 18 2025 11:05:45
Script end

Main resources:

Total runtime0.0182 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0086 588.0313152.6406
Module start 'layout' 0.00860.0028 740.671939.4766
Module start 'content' 0.01140.0047 780.148493.4609
Module end 'content' 0.01610.0021 873.609438.3047
Script end 0.0182  911.9141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002714.5337140.0002
Check MTime0.00126.4654140.0001
Mysql Total
Database connection0.002010.952910.0020
Mysqli_queries0.003217.434030.0011
Looping result0.00000.075810.0000
Template Total0.00179.510.0017
Template load0.00084.652110.0008
Template processing0.00094.784110.0009
Override
Cache load0.00063.276510.0006
General
dbfile0.00021.247680.0000
String conversion0.00000.054940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs