Forums / General / [Solved] Extract a content of a parent_node

[Solved] Extract a content of a parent_node

Author Message

Mohamed Ben-Ahssene

Thursday 19 March 2009 2:39:19 am

Hi

I'm new to ez publish, and i develop a portal.
i want to know how to extract a content of nodes that belong to a parent_node with a template function and display it
thank you

Noicokuna Niemoge

Thursday 19 March 2009 4:20:44 am

Documentation is your friend :)

No need to write 'urgent' as you can look up the solution by yourself.
http://ez.no/doc/ez_publish/technical_manual/4_0/templates/information_extraction

Shiki soku ze ku...

justin kazadi

Thursday 19 March 2009 4:23:34 am

Hi,
i don't know exactly what you wanna do but i think this doc could help you.

http://ez.no/doc/ez_publish/technical_manual/4_0/templates/information_extraction/outputting_node_and_object_data

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Yannick Komotir

Thursday 19 March 2009 5:37:18 am

Hi,

can you be more specific? Otherwise, you can simply make a fecth on the node in question in any template

{def $my_node=fetch( 'content', 'node', hash( 'node_path', 'news/article_test' ) )}
or
{def $my_node=fetch( 'content', 'node', hash( 'node_id', 96 ) )}
 

then you can extract content from your variable $my_node

<|- Software Engineer @ eZ Publish developpers -|>
@ http://twitter.com/yannixk

Mohamed Ben-Ahssene

Sunday 22 March 2009 2:12:41 am

Hi again!

I want to display all articles ( in parent folder node: 61) on home page (node 2)

i tried with this:

{def $article_array=fetch_alias(children, hash(parent_node_id, 61,
					offset, 0,
					sort_by, array(published, false()), limit, 14))}

{foreach $article_array as $article max 1}
	{node_view_gui view=large content_node=$article}
{/foreach}
{/def}

but it doesn't want to display articles, but i display the front-page content.

justin kazadi

Monday 23 March 2009 12:51:30 am

Hi,
if you want to display only the children of content class article ,
try this code:

{def $page_limit = 14
       $classes = array( 'identifiant_name_of_your_desired_class' )
        $children = array()
}
                                           
                                           
{set $children=fetch_alias( 'children', hash( 'parent_node_id', 61,
																                                                          'offset', $view_parameters.offset,
																                                                          'sort_by',array('modifield',false()),
																                                                          'class_filter_type', 'include',
																                                                          'class_filter_array', $classes,
																                                                          'limit', $page_limit ) )
{foreach $children as $child}

        {node_view_gui view=large content_node=$child}

{/foreach}{undef $children}


i think this would help you .
good luck

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Mohamed Ben-Ahssene

Monday 23 March 2009 1:21:15 am

Hi!

Thanks justin! it work, and I tried to test this:

{def $my_node=fetch('content' ,'list', hash('parent_node_id', 74, 'sort_by' array('published', false() )))}

{foreach $my_node as $index => $node}
	<div id="bloc{$index}">
		<div class="bloc">
			{$node.name|wash}
		</div>
		<div class="bloc-content">
			{$node.intro} {* for display the intro, but it doesn't work*}
		</div>
	</div>
	
{/foreach}

the first {$node.name|wash} work fine to display the name of an article ok!
but the second {$node.intro} doesn't work, i want to display the intro of an article, how can i do?
thank you!

justin kazadi

Monday 23 March 2009 1:29:36 am

Hi,
if you wanna to display the content of an attribute of an node, use this:

{attribute_view_gui attribute=$node.data_map.name_of_your_identifiant_attribute}

don't forget to read this doc:
http://ez.no/doc/ez_publish/techn...tion/outputting_node_and_object_data

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Mohamed Ben-Ahssene

Monday 23 March 2009 3:42:51 am

OK Cool Thank you , it work fine.
Thank you

eZ debug

Timing: Jan 18 2025 11:38:39
Script start
Timing: Jan 18 2025 11:38:39
Module start 'content'
Timing: Jan 18 2025 11:38:40
Module end 'content'
Timing: Jan 18 2025 11:38:40
Script end

Main resources:

Total runtime0.9308 sec
Peak memory usage4,096.0000 KB
Database Queries216

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 587.8359180.8203
Module start 'content' 0.00600.7960 768.6563695.2969
Module end 'content' 0.80210.1286 1,463.9531344.4375
Script end 0.9307  1,808.3906 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.4506210.0002
Check MTime0.00180.1924210.0001
Mysql Total
Database connection0.00070.078910.0007
Mysqli_queries0.839490.18362160.0039
Looping result0.00270.28622140.0000
Template Total0.894496.120.4472
Template load0.00190.208520.0010
Template processing0.892495.881420.4462
Template load and register function0.00030.028310.0003
states
state_id_array0.00080.082310.0008
state_identifier_array0.00290.311820.0015
Override
Cache load0.00170.1820540.0000
Sytem overhead
Fetch class attribute can translate value0.00200.213350.0004
Fetch class attribute name0.00170.1798110.0002
XML
Image XML parsing0.00150.160150.0003
class_abstraction
Instantiating content class attribute0.00000.0027130.0000
General
dbfile0.00230.2422330.0001
String conversion0.00000.000730.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
10content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 46
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs