Caution: This documentation is for eZ Publish legacy, from version 3.x to 6.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

get_class

Summary

Returns the class name of an object.

Usage

input|get_class( target )

Parameters

NameTypeDescriptionRequired
target any The target variable. Only if the input parameter is omitted.

Returns

A string containing the class name or FALSE.

Description

This operator gets the class of the input parameter or the target variable. It returns the PHP class name as a string. If both the input parameter and the target variable are provided, it is the target variable that will be evaluated. If the provided variable is not an object then the operator will return FALSE.

Examples

Example 1

{def $my_variable="Test"}
 
{if get_class( $my_variable )}
    Class detected.
{else}
    There is no class.
{/if}

The following output will be produced: "There is no class.".

Example 2

{get_class( $node )}

If $node is an actual content node, the following output will be produced: "ezcontentobjecttreenode".

Balazs Halasy (05/02/2004 12:29 pm)

Balazs Halasy (06/05/2005 7:18 am)


Comments

There are no comments.