Fetching nodes, while excluding the actual node

Author Message

Ahmed El Safty

Thursday 23 November 2006 8:19:15 am

Hi,

I am still a newbie, who happens to have to build several sites with eZPublish in no time.

Anyways to the Problem:

I read the following page, explaining the list Operator of the template fetch functions.

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/modules/content/fetch_functions/list

I understand the sorting algorithms, but I cannot find one, excluding a specific node, while displaying all other in the respective folder.

The situation: I have a a category (=folder) named e.g. "Sports". In it I store all articles related to Sports. I also build a special pagelayout for article presentation, so I have a column displaying the article ($module_result.content) and a right column displaying an ad and additional information.

The additional information should display "More related articles" and "More from this author".

So the problem is:

1.How do I fetch all other article titles of the sports section (display in additional information) without fetching the actual displayed node title, which is also a sports article.

2. How do I retrieve all other article -titles of the author of the actual node, excluding the actual node's title itself.

Since, I guess this is a common and important issue, when using eZ for a "News Site", I hope you guys can help me out....

Any help is really appreciated. thanks

and sorry if I really missed something obvious, I am an Newbie and tried to find a solution by myself, but in vain.

bye!

P.S.. I use eZ Publish 3.8.6

Ahmed El Safty

Friday 24 November 2006 5:13:51 am

Anybody with an idea?

Is the description of the problem not clear?

If not, please let me know.

thanks...

Harry Oosterveen

Friday 24 November 2006 8:31:40 am

Hi,

You can't solve all with the fetch functions, but the solution here would be to exclude the specific node in the template:

For example:

{def $nodes=fetch( 'content', 'list',
        hash( 'parent_node_id', 42,
              'depth', 3 ) )}
 
{foreach $nodes as $node}
    {if $node.node_id|eq(123)}
        {continue}
    {/if}
    {$node.name|wash} <br />
{/foreach}

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 31 2025 01:35:47
Script start
Timing: Jan 31 2025 01:35:47
Module start 'layout'
Timing: Jan 31 2025 01:35:47
Module start 'content'
Timing: Jan 31 2025 01:35:47
Module end 'content'
Timing: Jan 31 2025 01:35:47
Script end

Main resources:

Total runtime0.0210 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 588.2656151.2266
Module start 'layout' 0.00510.0039 739.4922220.7344
Module start 'content' 0.00900.0106 960.2266997.8672
Module end 'content' 0.01970.0013 1,958.093833.9922
Script end 0.0210  1,992.0859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002712.9266140.0002
Check MTime0.00115.1947140.0001
Mysql Total
Database connection0.00062.909710.0006
Mysqli_queries0.00199.158330.0006
Looping result0.00000.090910.0000
Template Total0.00094.310.0009
Template load0.00073.510510.0007
Template processing0.00020.805210.0002
Override
Cache load0.00052.410010.0005
General
dbfile0.00031.568480.0000
String conversion0.00000.037540.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