Compare node class

Author Message

Alan Fowler

Thursday 07 April 2011 5:02:11 am

Hi,

I wish to put an if statement in my template that will only show if the node class is equal to that of a certain class. I'm using the code below to fetch the class name from the list of classes, but how do I compare it to the class of the node?

Many thanks for any help

Alan

{def $class=fetch('content', 'class', hash('class_id', 16))}

Marko Žmak

Thursday 07 April 2011 6:39:56 am

You should compare the identifier of the class with the class_identifier of $node.object (where we suppose your node is in the $node variable).

Or you could compare the class ID (16) with the contentclass_id.

See documentation for ezcontentobject and ezcontentclass:

  • http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Objects/ezcontentobject
  • http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Objects/ezcontentclass

and also try this in your template:

{$class|attribute(show)}
{$node.object|attribute(show)}

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

Hubert Farnsworth

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.