is_class
Summary
Returns TRUE if an object is an instance of a specific class.Usage
input|is_class( name [, object ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
name | string | The class name that should be matched. | Yes. |
object | object | An object of any type (instead of the input parameter). | Only if the input parameter is omitted. |
Returns
TRUE or FALSE.Description
This operator attempts to find out the class name of the object that is provided either as the input parameter or the "object" parameter. If the name of the class matches the name provided using the "name" parameter, the function will return TRUE; otherwise FALSE will be returned.
Examples
Example 1
{if $node|is_class( 'ezcontentobjecttreenode' )} Everything is okay. {else} Something is wrong. {/if}
As long as the $node refers to an instance of the "ezcontentobjecttreenode" class, the following output will be produced: "Everything is okay.".
Example 2
{if is_class( 'ezcontentobjecttreenode', $node )} Everything is okay. {else} Something is wrong. {/if}
As long as the $node refers to an instance of the "ezcontentobjecttreenode" class, the following output will be produced: "Everything is okay.".
Balazs Halasy (05/02/2004 12:33 pm)
Balazs Halasy (06/05/2005 7:21 am)
Comments
There are no comments.