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.