eZ Community » Forums » Setup & design » Template Override Conditions

Template Override Conditions

Template Override Conditions

Saturday 05 March 2011 2:41:39 pm - 6 replies

I like to override multiple nodes with the same "full-view" template.

As http://doc.ez.no/eZ-Publish/Techn...ference/Template-override-conditions says, i cannot easily have more than one node ID in an override block. So, i duplicated the override block, which works.

To be more flexible, when new nodes are added (which should use the same template), i'd like to use the node name (e.g. "News"blunk.gif Emoticon as an override condition. So, i do not have to edit override.ini all the time.

I don't want to introduce a new class for it (using "folders" currently). I know, that all nodes, that need to be overridden are at the same node tree level, are "folder" objects and will be names "news". But i do not know the parent node ID. Specifically, i want to have an override condition, which does not rely on Node IDs, so i do not need to tamper override.ini.

To complicate things, i need (an other) override for the (direct) child nodes of these (multiple) "news" nodes.

I tried to use Match[url_alias], but this requires, that i speficy the complete url.

I'd prefer to specify the Node name or the last part of the url_alias to find the correct nodes.



does not seem to work.



does not exist.

How do i solve this problem best?

Modified on Saturday 05 March 2011 2:42:17 pm by Marco Zinn

Sunday 06 March 2011 4:08:17 pm

You can see your options in eznodeviewfunctions.php, they are:

$keyArray = array( array( 'object', $object->attribute( 'id' ) ),
                           array( 'node', $node->attribute( 'node_id' ) ),
                           array( 'parent_node', $node->attribute( 'parent_node_id' ) ),
                           array( 'class', $object->attribute( 'contentclass_id' ) ),
                           array( 'class_identifier', $node->attribute( 'class_identifier' ) ),
                           array( 'view_offset', $offset ),
                           array( 'viewmode', $viewMode ),
                           array( 'remote_id', $object->attribute( 'remote_id' ) ),
                           array( 'node_remote_id', $node->attribute( 'remote_id' ) ),
                           array( 'navigation_part_identifier', $navigationPartIdentifier ),
                           array( 'depth', $node->attribute( 'depth' ) ),
                           array( 'url_alias', $node->attribute( 'url_alias' ) ),
                           array( 'class_group', $object->attribute( 'match_ingroup_id_list' ) ),
                           array( 'state', $object->attribute( 'state_id_array' ) ),
                           array( 'state_identifier', $object->attribute( 'state_identifier_array' ) ),
                           array( 'section', $object->attribute( 'section_id' ) ),
                           array( 'section_identifier', $sectionIdentifier ) );
$keyArray[] = array( 'parent_class', $parentClassID );
$keyArray[] = array( 'parent_class_identifier', $parentClassIdentifier );

Plenty of possibilities blunk.gif Emoticon

Sunday 06 March 2011 7:21:05 pm

André, thanks for the hint and link to the PHP source.

But i don't see, which of the options fits my situation here and how i should set up the block in the override.ini . Did i oversee an option? In particular, i dont' see, if e.g. "url_alias" can help me here.

By the way: Personally, i think, one should need need to find and read a PHP source code to find out how to "use" (in this case: configure & design) an ez Installation. The docs should be up to date and complete.

But, thanks anyway happy.gif Emoticon

Sunday 06 March 2011 9:34:47 pm

They are, it's just easier for me to lookup the source code.
The doc on this is here under node/view/*.tpl.

As for your original question, it sound to me like you should create a new class. Even if it has the same attributes like some other class you obviously present it in another way, so a different object type makes most sense (IMHO) and probably makes it a lot easier for your editors to deal with this as well.

Class inheritance would help here, but I don't see us getting time to implement that anytime soon.

Modified on Sunday 06 March 2011 9:36:13 pm by André R

Monday 07 March 2011 9:59:21 am

Are you willing to do a kernel hack for this?

I remember doing a hack to add sub_tree to the Match options but I'm not finding the code. If you're interested then I'll keep looking.

This is what I'm talking about:


Something similar can be done for name.

Modified on Monday 07 March 2011 10:10:47 am by Steven E Bailey

Monday 07 March 2011 11:48:32 am


Like André, the best approach would be to create custom class. In terms of design of content in eZ Publish, it's the best practice.

If really you do not want to do that, perhaps you can write some custom code in a content edit handler to assign a custom section or a custom object state depending on your condtions (the name News...) but it's longer to implement.


Monday 07 March 2011 2:29:56 pm

There is a new and improved version of the hack mentioned by Steve. It's especially handy for multilingual sites.


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from