eZ Community » Forums » Setup & design » Detecting locations of a node? Is...
expandshrink

Detecting locations of a node? Is there any attribute.

Detecting locations of a node? Is there any attribute.

Wednesday 29 November 2006 1:54:20 pm - 3 replies

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..

Wednesday 29 November 2006 6:13:46 pm

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/techn...ence/objects/ezcontentobjecttreenode

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

Wednesday 29 November 2006 6:19:17 pm

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/techn...modules/content/fetch_functions/list

Monday 04 December 2006 1:14:13 pm

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).

expandshrink

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

36 542 Users on board!

Forums menu