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.

eZ debug

Timing: Jan 18 2025 20:55:45
Script start
Timing: Jan 18 2025 20:55:45
Module start 'layout'
Timing: Jan 18 2025 20:55:45
Module start 'content'
Timing: Jan 18 2025 20:55:45
Module end 'content'
Timing: Jan 18 2025 20:55:45
Script end

Main resources:

Total runtime0.6372 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.1563152.6563
Module start 'layout' 0.00610.0037 740.812539.5078
Module start 'content' 0.00970.6262 780.3203552.3281
Module end 'content' 0.63590.0012 1,332.648412.1094
Script end 0.6372  1,344.7578 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.5258160.0002
Check MTime0.00140.2188160.0001
Mysql Total
Database connection0.00080.124410.0008
Mysqli_queries0.583391.5319600.0097
Looping result0.00050.0842580.0000
Template Total0.607195.320.3035
Template load0.00190.300820.0010
Template processing0.605194.964220.3026
Template load and register function0.00020.024710.0002
states
state_id_array0.00060.089010.0006
state_identifier_array0.00080.126520.0004
Override
Cache load0.00170.2666370.0000
Sytem overhead
Fetch class attribute can translate value0.00090.137520.0004
Fetch class attribute name0.00120.191350.0002
XML
Image XML parsing0.00070.108920.0003
class_abstraction
Instantiating content class attribute0.00000.002060.0000
General
dbfile0.00150.2400160.0001
String conversion0.00000.001840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs