eZ Community » Forums » Developer » How to fetch contents in...
expandshrink

How to fetch contents in "page_mainarea.tpl"?

How to fetch contents in "page_mainarea.tpl"?

Thursday 15 March 2012 11:33:06 am - 2 replies

Hi,

I'm having some troubles doing fetches in "page_mainarea.tpl", I think eZ Publish lost the ability to fetch in children nodes. To exemplify, I have this content structure:

 Level1 - Folder (Folder)
                         |________> Level 2 - Article (Article)
                         |________> Level 2 - OtherArticle (Article)
                                                                             |________> Level 3 - OtherOtherArticle1 (Article)
                                                                             |________> Level 3 - OtherOtherArticle2 (Article)

I can do this fetch in Level 1 but not in other levels:

     {def $articles_in_node = fetch('content', 'list', hash('parent_node_id', $module_result.content_info.node_id, 
                                               'class_filter_type', 'include',
                                               'class_filter_array', array('folder', 'article'),
                                               'sort_by', array('priority', true()),
                                               'depth', 6))}

The weid thing is that I have available the variables "$module_result.content_info.node_id" and "$module_result.content_info.node_id" in all levels, but the Fecth's using this variables only work on Level1.

Any clues on what I'm missing here?

Best Regards,

Friday 16 March 2012 3:20:11 pm

It normal it doesn't fetch node at different depth if you specify "depth=6" ?

Friday 16 March 2012 5:02:42 pm

Quote from H-Works Agency :

It normal it doesn't fetch node at different depth if you specify "depth=6" ?

I've specified depht 6 as example, It works as well but will give me some duplicate information.

My problem was solve using a cache-block covering the "page_mainarea.tpl", with the cache block the variables are not lost... Can someone explain why?

With this I lost the results of Fetch's:

 
 
    <!-- Main area: START -->    {include uri='design:page_mainarea.tpl'}    <!-- Main area: END -->

The solution was to use a cache-block like this:

 
 
    {cache-block keys=array( $module_result.uri, $user_hash, $extra_cache_key )}        <!-- Main area: START -->        {include uri='design:page_mainarea.tpl'}        <!-- Main area: END -->    {/cache-block}

Someone have an explanation/theory why without using a cache block I lost the Fetch results in a variable?

 

Best Regards,

Modified on Friday 16 March 2012 5:04:02 pm by F J

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from