Detecting locations of a node? Is there any attribute.

Author Message

Ahmed El Safty

Wednesday 29 November 2006 4:54:20 am

Hi folks,

here's the thing:

I have a folder named "Themes" and sub-folders like "Sports" "People" "News" to categorize all articles I publish. Only Main Nodes.

To differentiate between current issues and older ones I have a folder named "Current" where I store all articles I want to display in the "Current Issues" <div>. The folder is practically functioning as a flag.

Now. On another <div> I want to display all articles, excluding those articles who have a second location, namley the "Current Issue" folder/location.

SO:

--------------------------------------------------------------------------------------------------------------------------------
Is there any attribute or other way to find out, if an object has more than one locations?
In this case I would just loop through all articles, excluding those who have a location named "Current Issues"?
--------------------------------------------------------------------------------------------------------------------------------

The other way, would probably be a nested loop, the outer loops all articles, the inner only those who are in the folder "Current Issues", and then compare the nodes if they match. If yes, I could just issue an {continue} in the loop. This solution is not preferred though, for the processing time.

Any answer is appreciated.

thanks..

Kristian Hole

Wednesday 29 November 2006 9:13:46 am

Hi Ahmed,

The assigned nodes is available on the object.

Here is an example code that lists all the paths to the assigned nodes:

{foreach $node.object.assigned_nodes as $assignednode}
   {$assignednode.path_identification_string} <br />
{/foreach}

The $node variable has the following available information:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezcontentobjecttreenode

The $node.object:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/objects/ezcontentobject

Kristian

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

Kristian Hole

Wednesday 29 November 2006 9:19:17 am

Actually. In your case, you might be able to use the "main_node_only" parameter to the "list" or "tree" fetch to only return the main node of your nodes.

See here:
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

Kristian

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

Ahmed El Safty

Monday 04 December 2006 4:14:13 am

Hello Kristian,

Late but: THANK YOU!

the first solution worked well.

The main_node_only attribute would not work with the particular problem logic I have: I wanted to exclude all "Main Nodes" from the fetch, whose objects are encapsulated by another node (different location).

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