Extracting the class name from a node

Author Message

Randeep Walia

Wednesday 01 September 2004 11:09:51 pm

I swear this seems like it should be the most basic thing in the world but I can't seem to find it documented anywhere!

In my template I want to extract the class name from the current node. That's all, but I don't know how its done.

It doesn't seem to be a default attribute or in data_map or anything. Can anyone point me in the right direction?

Randeep

__________________________________
Randeep Walia is http://www.rundeep.net powered by EZ Publish

Hans Melis

Thursday 02 September 2004 6:23:59 am

Hi,

A node doesn't have a class name, but the contentobject inside the node has it. Translated into template language:

{$node.object.class_name}

Hans
http://blog.hansmelis.be

Randeep Walia

Thursday 02 September 2004 10:19:36 am

Thanks,

You know I <i>was</i> messing around with the object of the node figuring the answer lay there but I was trying to use class_id or something.

Also I was trying to use the attribute operator which I couldn't get to work last night but is working now, for some reason and would have solved my dilemma. One thing that isn't working however, is when I try to do

{$node.object|attribute("show_values")}

I've tried with and without quotes around the 'show_values' but to no avail- I just get the listing of attributes and not their values.

Also I wonder why I couldn't find the answer to my solution in existing documentation or forums: are the properties of objects documented somewhere on this website?

__________________________________
Randeep Walia is http://www.rundeep.net powered by EZ Publish

Hans Melis

Thursday 02 September 2004 12:28:15 pm

"show_values" doesn't exist as a valid option. That seems to be quite misleading in the documentation, but the explanation does mention the correct value for the first parameter. The most common form is:

{$node.object|attribute(show)}

I don't know if a list of properties of objects is documented. I know the most important ones by heart because I started back when there was no documentation at all (at least not for developers). If I want to know the properties of objects, I just look the PHP file of the class.

Hans
http://blog.hansmelis.be

Andrew Vorobyov

Sunday 13 February 2005 3:41:21 am

Thank you!!! Now I've got what I needed

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

Main resources:

Total runtime0.9076 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.1484152.6250
Module start 'layout' 0.00650.0034 741.773439.4453
Module start 'content' 0.00990.8960 781.2188595.7500
Module end 'content' 0.90590.0017 1,376.968816.1563
Script end 0.9076  1,393.1250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3645160.0002
Check MTime0.00140.1501160.0001
Mysql Total
Database connection0.00070.072110.0007
Mysqli_queries0.847293.3413650.0130
Looping result0.00080.0850630.0000
Template Total0.868295.620.4341
Template load0.00210.231220.0010
Template processing0.866095.416820.4330
Template load and register function0.00010.010210.0001
states
state_id_array0.00110.118410.0011
state_identifier_array0.00200.219720.0010
Override
Cache load0.00170.1902280.0001
Sytem overhead
Fetch class attribute can translate value0.00090.098530.0003
Fetch class attribute name0.00100.114370.0001
XML
Image XML parsing0.00110.125930.0004
class_abstraction
Instantiating content class attribute0.00000.002190.0000
General
dbfile0.00090.1023210.0000
String conversion0.00000.001140.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs