Is there any function in smarty to check valid object of class in smarty?
Suppose $obj
is having some value or not.
How to check $obj
is object of 'TestClass' or not in smarty?
This is the way to check variable is object of specific class in Smarty.
if( true eq isset($obj) && true eq is_object($obj) && $obj instanceof 'TestClass' ){
//do something
}
this works in Smarty2 and Smarty3:
{if $obj instanceof TestClass}
…
{/if}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With