Forums / Setup & design / trouble with attributes

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.

:)

eZ debug

Timing: Jan 19 2025 01:21:19
Script start
Timing: Jan 19 2025 01:21:19
Module start 'content'
Timing: Jan 19 2025 01:21:20
Module end 'content'
Timing: Jan 19 2025 01:21:20
Script end

Main resources:

Total runtime1.1845 sec
Peak memory usage4,096.0000 KB
Database Queries206

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 588.9453180.8438
Module start 'content' 0.00660.9946 769.7891574.3672
Module end 'content' 1.00120.1832 1,344.1563341.0703
Script end 1.1844  1,685.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00520.4414210.0002
Check MTime0.00150.1255210.0001
Mysql Total
Database connection0.00080.065910.0008
Mysqli_queries1.080291.19822060.0052
Looping result0.00240.20642040.0000
Template Total1.151397.220.5756
Template load0.00230.192220.0011
Template processing1.149097.004620.5745
Template load and register function0.00010.011110.0001
states
state_id_array0.00110.093210.0011
state_identifier_array0.00120.099020.0006
Override
Cache load0.00240.1999640.0000
Sytem overhead
Fetch class attribute can translate value0.00160.135730.0005
Fetch class attribute name0.00190.163590.0002
XML
Image XML parsing0.00360.306330.0012
class_abstraction
Instantiating content class attribute0.00000.0027140.0000
General
dbfile0.00410.3499330.0001
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 39
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs