[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

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 16:13:58
Script start
Timing: Jan 18 2025 16:13:58
Module start 'layout'
Timing: Jan 18 2025 16:13:58
Module start 'content'
Timing: Jan 18 2025 16:13:58
Module end 'content'
Timing: Jan 18 2025 16:13:58
Script end

Main resources:

Total runtime0.0136 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.0391152.6406
Module start 'layout' 0.00540.0025 740.679739.4766
Module start 'content' 0.00790.0040 780.1563101.4609
Module end 'content' 0.01190.0017 881.617242.3047
Script end 0.0136  923.9219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002518.2667140.0002
Check MTime0.00118.1096140.0001
Mysql Total
Database connection0.00064.694110.0006
Mysqli_queries0.002115.448530.0007
Looping result0.00000.087610.0000
Template Total0.001410.510.0014
Template load0.00085.853610.0008
Template processing0.00064.576710.0006
Override
Cache load0.00064.378810.0006
General
dbfile0.00021.816380.0000
String conversion0.00000.043840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs