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