Create two override template for two different node_list

Author Message

Manuela Pedrotti

Tuesday 04 July 2006 6:14:30 am

Hi,

I created in right toolbar two node_list and i want override each node_list with a different template!
How can I do it?

Evgeniy K

Tuesday 04 July 2006 1:12:30 pm

Hello, Manuela.

Sorry for my bad English, I'm Russian.

You can creat a new tool for toolbar, for example "node_list2", add it to your toolbar too, and make different template overrides for "node_list" and "node_list2".

You must add to the file toolbar.ini.append.php located at settings/siteaccess/your_site_name/toolbar.ini.append.php

[Tool]
AvailableToolArray[]=node_list2

[Tool_node_list2]
parent_node=2
title=Latest items
show_subtree=
limit=5
sort_by=published
treelist_check=yes

[Tool_node_list2_description]
parent_node=Item source
title=Title
show_subtree=Show in subtree
limit=Number of items
sort_by=Sort on attribute
treelist_check=Fetch whole tree?

Then you must create 2 templates for this tool, both are called node_list2.tpl. Just duplicate the files "node_list.tpl" and call them "node_list2.tpl". The location of node_list2.tpl must be the same as location of node_list.tpl : the first file (source, node_list.tpl, and your new file node_list2.tpl) location is design/standard/templates/toolbar/full/ , and the second file locate at design/standard/templates/toolbar/line/. Duplicate them, rename to node_list2.tpl, and enjoy.
Now you can add different node lists to your toolbar, and create different overrides for node_list.tpl and node_list2.tpl, even if both of them are located on the same page.

And if your 2 node lists are on the different pages, it is much easier: you can use "match" condition in override.ini.append.php . For example, to apply override only for main page:

Match[node]=2

Best regards, Evgeniy.

Manuela Pedrotti

Wednesday 05 July 2006 1:55:30 am

Hi Evgeniy,

its work!!

Best regard
Manuela

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