Using "fetch by owner"

Author Message

Steph A

Friday 14 October 2005 9:54:21 pm

Still having problems showing just the current users articles etc..

Does anyone have a working code for this?

I have tried this code

{*?template charset=utf-8?*}
<h1>User articles</h1>

{* Grab some of the content of the node that is being viewed. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
                                     attribute_filter,
                                     array( array( 'owner', '=', $current_user.contentobject_id ) )) )}

{* LOOP: For each child of the node... *}
{section name=Child loop=$children}

    {* Display the content of the child using a line-view template. *}
    {node_view_gui view=line content_node=$Child:item}

    <hr>

{* End of loop. *}
{/section}

{* End of namespace. *}
{/let}

..and then it returns

Unknown template variable 'current_user' in namespace ''

I am a newbie to this, so its probably something basic....or?

*please help*

Mazen Alsibai

Sunday 16 October 2005 3:05:47 am

Hi:
you have to fetch the current user like this:
{let current_user=fetch('user','current_user')}
<h1>User articles</h1>

{* Grab some of the content of the node that is being viewed. *}
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
attribute_filter,
array( array( 'owner', '=', $current_user.contentobject_id ) )) )}

{* LOOP: For each child of the node... *}
{section name=Child loop=$children}

{* Display the content of the child using a line-view template. *}
{node_view_gui view=line content_node=$Child:item}

<hr>

{* End of loop. *}
{/section}

{* End of namespace. *}
{/let}
{/let}{*fetch user*}

Steph A

Sunday 16 October 2005 10:32:45 pm

Of course... that worked ;)

Thank you very much!

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

Main resources:

Total runtime0.7596 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0092 587.7891152.6094
Module start 'layout' 0.00920.0034 740.398439.4297
Module start 'content' 0.01260.7453 779.8281476.7656
Module end 'content' 0.75790.0016 1,256.59388.1875
Script end 0.7595  1,264.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00490.6441160.0003
Check MTime0.00160.2110160.0001
Mysql Total
Database connection0.00120.156010.0012
Mysqli_queries0.704892.7820570.0124
Looping result0.00060.0764550.0000
Template Total0.721395.020.3607
Template load0.00240.311620.0012
Template processing0.719094.647720.3595
Template load and register function0.00030.037810.0003
states
state_id_array0.00130.165210.0013
state_identifier_array0.00110.139120.0005
Override
Cache load0.00190.2558330.0001
Sytem overhead
Fetch class attribute can translate value0.00070.094520.0004
Fetch class attribute name0.00200.259130.0007
XML
Image XML parsing0.00020.032420.0001
class_abstraction
Instantiating content class attribute0.00000.001330.0000
General
dbfile0.00110.1451100.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs