Forums / General / name of a parent

name of a parent

Author Message

Jack Rackham

Thursday 14 April 2005 7:43:35 am

Is it possible to fetch the name of a parent folder?

J-A Eberhard

Thursday 14 April 2005 7:59:48 am

$module_result.content_info.parent_node_id will gives you the parent node id

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

kracker (the)

Thursday 14 April 2005 8:59:57 am

I did this just today, does anyone have some ideas on how I could improve this solution?

The approach I took was to call a second fetch to get the current item's parent's name.

Abbreviated:
{set parent_id=$cnews.parent_node_id}
{set parent=fetch('content','node', hash('node_id', $parent_id , limit, 1 , sort_by, array(array(published, false() )) )) }
{set news_category=$parent.name}
New Objects: <br />
<span style="font-size: 11px;">
  {set news_id=344}
  {set news_limit=4}

  {let recent=fetch( content, tree, hash( parent_node_id, $news_id, limit, $news_limit, 'class_filter_type', 'include', 'class_filter_array', array( 'article' ) , sort_by, array(array(published, false() )))) }
  {section show=$recent|count|gt(0)}
    {section var=cnews loop=$recent}
      {set news_title=$cnews.name}
      {set news_intro=$cnews.data_map.intro.data_text}
      {set news_date_formated=$cnews.object.current.created |datetime( 'custom', '%m/%d/%Y @ %h:%i' )}

      {set parent_id=$cnews.parent_node_id}
      {set parent=fetch('content','node', hash('node_id', $parent_id , limit, 1 , sort_by, array(array(published, false() ) ) )) }
      {set news_category=$parent.name}
      <div style="padding-top: 2px; padding-bottom: 8px;"><span><a href="{$cnews.url_alias}" style="color:#004A84;">{$news_title|shorten(348)}</a></span><div align="right"><span style="font-style: italic;">Added to Category: {$news_category}<br /><span style="font-size: 10px; color: grey;">Released: {$news_date_formated}</span></div></div>
    {/section}
  {/section}
 {/let}
</span>

//kracker

mst3k : why study industrial arts?

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Łukasz Serwatka

Friday 15 April 2005 1:33:28 am

Here is the code.

{$node.parent.name}

or

{$node.parent_node_id}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Ekkehard Dörre

Friday 15 April 2005 7:18:56 am

... and the grandparent:
How to find the parent and grandparent of an object.
http://ez.no/ez_publish/documentation/incoming/how_to_find_the_parent_and_grandparent_of_an_object

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Łukasz Serwatka

Friday 15 April 2005 7:23:09 am

... and ;)

{$node.parent.parent_node_id} //grandparent id

It`s always good to view attributes, btw

{$node|attribute}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Ekkehard Dörre

Saturday 16 April 2005 2:38:39 am

... and ;-))

there are more interestings thinks to look after:

module_result <br />{$module_result|attribute(show,2)}
designkeys <br />{$DesignKeys:used|attribute(show,2)}
view_parameters <br />{$view_parameters|attribute(show)}
uri_string {$uri_string} <br />
site <br />{$site|attribute(show)}
ezinfo <br /> {$ezinfo|attribute(show)}

@Lukasz: Thank You, nice surprise ;-) ,at pinboard now.

Greetings, ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Jack Rackham

Saturday 16 April 2005 7:02:45 am

Strangely {$node.parent.name} work on my page, I did not think that $node worked in pagelayout overrides!

Bertrand Dunogier

Monday 29 August 2005 10:41:15 am

Jack, don't use it in pagelayout... it works as long as ViewCaching is disabled. Once enabled, you'll run into baaaad surprises :)

Use $module_result.content_info.node_id to fetch what you need (for instance) but don't use $node as is.

To knowledgeable people: is it right to use .parent and .children for nodes once fetched ? With those, as far as I can see, you can theorically browse the entire structure tree in one go... like

{$node.parent.parent.parent.children[0].children[1]...

What's the cost of that ?

Jack Rackham

Thursday 01 September 2005 2:55:55 am

There was a bug in 3.5 so when I upgraded to 3.6 I kept the bug.
http://ez.no/community/bugs/smart_cache_is_impossible_to_disable_in_3_5_2_and_3_6

eZ debug

Timing: Jan 19 2025 04:44:48
Script start
Timing: Jan 19 2025 04:44:48
Module start 'content'
Timing: Jan 19 2025 04:44:49
Module end 'content'
Timing: Jan 19 2025 04:44:49
Script end

Main resources:

Total runtime0.7092 sec
Peak memory usage4,096.0000 KB
Database Queries223

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0103 588.8203180.8516
Module start 'content' 0.01030.5843 769.6719805.6406
Module end 'content' 0.59460.1145 1,575.3125348.4609
Script end 0.7091  1,923.7734 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00450.6404210.0002
Check MTime0.00180.2585210.0001
Mysql Total
Database connection0.00220.314410.0022
Mysqli_queries0.612886.40592230.0027
Looping result0.00220.30652210.0000
Template Total0.668594.320.3342
Template load0.00230.322820.0011
Template processing0.666293.936620.3331
Template load and register function0.00010.013510.0001
states
state_id_array0.00180.252110.0018
state_identifier_array0.00180.259320.0009
Override
Cache load0.00200.2789520.0000
Sytem overhead
Fetch class attribute can translate value0.00150.206670.0002
Fetch class attribute name0.00100.1351150.0001
XML
Image XML parsing0.00270.376670.0004
class_abstraction
Instantiating content class attribute0.00000.0048190.0000
General
dbfile0.00280.3964540.0001
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
9content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 43
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs