Forums / General / problem getting class of an object

problem getting class of an object

Author Message

Marko Žmak

Sunday 11 July 2004 7:00:54 am

I'm using get_class on an object like this:

{$forum.item|get_class}

where $forum is a loop variable. I also tried this:

{$forum.item.object|get_class}

And I get these results:

ezcontentobjecttreenode
ezcontentobject

How can I found out the real class of an object, for example, detect if some object is of class Folder or class Article?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Paul Forsyth

Sunday 11 July 2004 8:05:59 am

I think the operator is working as expected but it is, for me, the wrong answer. The operator is returning the PHP class, not the eZ publish class, which is the expected answer...

Can you file a bug enhancement? Its not quite a bug.

For the class you can get the class id from this:

{$forum.item.object.contentclass_id}

paul

--
http://www.visionwt.com

Marko Žmak

Sunday 11 July 2004 12:03:59 pm

That's what i was looking for. Thanks.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Tuesday 13 July 2004 9:15:00 am

With:

{$forum.item.object.contentclass_id}

i get the class ID, but how do I get the class identifier? E.g. article for Article class,

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Paul Forsyth

Tuesday 13 July 2004 12:32:05 pm

Its as it sounds:

{$forum.item.object.class_identifier}

To see what fields there are try:

{$forum.item.object|attribute(show)}

paul

--
http://www.visionwt.com