trouble with attributes

Author Message

Aleksandar Adam

Saturday 09 July 2005 4:01:35 pm

I have the following problem:

I have a line with "fetch" like this:

let children=fetch('content','tree',hash(parent_node_id,$node.node_id,limit,5, class_filter_type, 'exclude', class_filter_array, array(21,20,27,1,2)

then I would like to print "forum reply" attributes in the following lines:

section name=Child loop=$children
attribute_view_gui attribute=$Child:item.......
/section

I don't know what to write after the "$Child:item" to reach the following attributes of the "forum reply" class:
- the name of the "forum reply" object
- the author's name
- the date
so that i got something in style:

reply xxxx
Forum User, 6th june 2005

and if it is possible to klick on the reply and the read the whole text

I have tried everything what I could possibly think out and now I got a terrbile headache, any answer will be appreciated

Eivind Marienborg

Sunday 10 July 2005 1:28:37 am

Hi Aleksander :)

To see all attributes of an object, use the attribute(show) function, like this:

{$Child:item|attribute(show)}

If you for example want to access the authors name, it's probably shown like this

> Item
>> Object
>>> owner
>>>> Name

To use it in a template you use

{$Child:item.object.owner.name}

Look for the other attributes, and use it in the same way. If you need to see further down in the attribute tree, adjust the depth like this:

{$Child:item|attribute(show,5)}

Where 5 is the depth in this example. But in my experience, going deeper than 4 usually crashes eZ.

Hope this helps :)

Aleksandar Adam

Sunday 10 July 2005 1:35:25 am

Thanks it works, :-)

but now I am little bit curious, why did't it work with:

attribute_view_gui attribute=$Child:item.object...

what is the difference?

Eivind Marienborg

Sunday 10 July 2005 2:09:00 am

What's the full attribute you specified in "Child:item.object..."?

The attribute_view_gui displays ez-attributes, but if you for example use $Child:item.object.owner.name, that's simply a string (and not an ez-attribute), so it doesn't need to be passed throught the attribute_view_gui to be proparly displayed.

Eivind Marienborg

Sunday 10 July 2005 2:13:49 am

This is the section-code I use to display the last replies in my eZ-forum. It displays the title of the thread, with date and author on mouseover, and the number of replies and parent (usually a forum).

If you're gonna use it, notice that I haven't used namespaces in it, so you have to adjust this/your code a bit.

{section loop=$:topics}

<li><div class="name"><a href={$:item.url_alias|ezurl} title="Last reply: {$:item.modified_subnode|l10n(datetime)} by {$:item.object.owner.name}">{$:item.name}</a>
</div>
<div class="reply">{$:item.children_count} replies</div>
<div class="parent"><a href={$:item.parent.url_alias}>{$:item.parent.name}</a>
</div></li>

{/section}

Aleksandar Adam

Sunday 10 July 2005 3:58:04 am

I have used:

attribute_view_gui attribute=$Child:item.object.name

attribute=attribute_view_gui attribute=$Child:item.object.data_map.name

and many other wrong combinations, so i wonder what is the correct way.

Eivind Marienborg

Sunday 10 July 2005 9:47:10 am

You do this:

{$Child:item.name}

No attribute_view_gui at all.

:)

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 08:16:20
Script start
Timing: Jan 31 2025 08:16:20
Module start 'layout'
Timing: Jan 31 2025 08:16:20
Module start 'content'
Timing: Jan 31 2025 08:16:20
Module end 'content'
Timing: Jan 31 2025 08:16:20
Script end

Main resources:

Total runtime0.0134 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.0043 588.1250151.2109
Module start 'layout' 0.00430.0032 739.335936.6484
Module start 'content' 0.00740.0045 775.984498.2500
Module end 'content' 0.01190.0015 874.234437.9922
Script end 0.0134  912.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002216.5799140.0002
Check MTime0.00107.7009140.0001
Mysql Total
Database connection0.00064.442210.0006
Mysqli_queries0.003022.456030.0010
Looping result0.00000.104810.0000
Template Total0.00128.610.0012
Template load0.00096.677410.0009
Template processing0.00031.863910.0003
Override
Cache load0.00064.635810.0006
General
dbfile0.00031.885380.0000
String conversion0.00000.053340.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