Forums / Setup & design / Templates match with more than one node

Templates match with more than one node

Author Message

willy jansen

Wednesday 29 September 2004 8:12:12 am

How di I configure override.ini.append.php so a template matches one or more nodes?

[special_view]
Source=node/view/full.tpl
MatchFile=full/special_view.tpl
Subdir=templates
Match[node]=163,164

or

[special_view]
Source=node/view/full.tpl
MatchFile=full/special_view.tpl
Subdir=templates
Match[node]=163
Match[node]=164

Anybody any idea?

Alex Jones

Wednesday 29 September 2004 8:31:27 am

Actually, you have to do:

[special_view_1]
Source=node/view/full.tpl
MatchFile=full/special_view.tpl
Subdir=templates
Match[node]=163

[special_view_2]
Source=node/view/full.tpl
MatchFile=full/special_view.tpl
Subdir=templates
Match[node]=164

Rather repetitive, but sadly, that's how the system works.

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Frederik Holljen

Wednesday 29 September 2004 11:31:52 pm

I've put this on my list of "nifty things that we should implement".

Alex Jones

Thursday 30 September 2004 10:40:17 am

That's great to hear Frederik! One more request, which I believe I filed as a bug/suggestion a good while back (let me know if I should do it again):

Template matching should not be founded on a principal of order within the override.ini.append file, rather it should be based on a foundation of specificity, like CSS. For example, I have the following overrides in my override.ini.append file, in the order shown (Assume the they all have the ability to affect one node, which is of class 14, is a child of node 2, and has a node of 23):

[first_override]
Source=node/view/full.tpl
MatchFile=full/first_override.tpl
Subdir=templates
Match[class]=14

[second_override]
Source=node/view/full.tpl
MatchFile=full/second_override.tpl
Subdir=templates
Match[parent_node]=2

[third_override]
Source=node/view/full.tpl
MatchFile=full/third_override.tpl
Subdir=templates
Match[node]=23

The current implementation would automatically apply the first override, ignoring the other two, which are more specific. This really isn't logical from a user/site developer stand point, though it may make sense from the CMF developer's standpoint - I assume, it cuts down on the time it takes to find the right override, please correct me if I am wrong. Ideally, the system would see that the third override is the most specific and apply it instead of the other two.

I know it is a lot to ask, but I figured I would ask anyway. ;)

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Frederik Holljen

Thursday 30 September 2004 11:51:58 pm

I'll put this in my list as well. I don't think this is anything we'll do in the near future though.

willy jansen

Friday 01 October 2004 11:37:32 am

Thanks for the hint. It works perfect.

Alex Jones

Friday 01 October 2004 12:33:55 pm

<b>Frederik:</b> Thanks for adding it to the list. I know it is a long shot. ;)

<b>Willy:</b> Glad to help!

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>