Page 1 of 1

[SOLVED] How to get methods of object in smarty?

Posted: Fri May 22, 2009 6:52 pm
by Sonya
Hello,

I would like to know what methods the object {$feu_smarty} has. I have tried:

Code: Select all

{dump item=feu_smarty}
And the output is:

Code: Select all

Dump of: $feu_smarty (NULL)
Any other possibility to get the methods of the object?

Thank you,
Sonya

Re: How to get methods of object in smarty?

Posted: Fri May 22, 2009 7:22 pm
by JeremyBASS
you can find them in class.feu_smarty.php

 {$feu_smarty->get_users_by_groupname('Employee','mymembers')}
aka
{$feu_smarty->get_users_by_groupname($groupname,$assign)}

and

{$feu_smarty->get_user_properties($entry.id,'userprops')}
aka
{$feu_smarty->get_user_properties($uid,$assign)}

thou I have requested one more at the least

http://dev.cmsmadesimple.org/feature_request/view/3442

hope that helps

cheers
jeremyBass

Re: How to get methods of object in smarty?

Posted: Fri May 22, 2009 8:39 pm
by Sonya
JeremyBASS wrote: you can find them in class.feu_smarty.php
Thank you. I have already found it :)

The question was in general: How to get methods of object in smarty? $feu_smarty was just an example :)

Re: How to get methods of object in smarty?

Posted: Fri Oct 09, 2009 9:09 am
by aleksanderlech
Did you find any solution for getting object's methods and properties?

Regards
Aleksnader

Re: How to get methods of object in smarty?

Posted: Mon Oct 12, 2009 6:06 pm
by Sonya
aleksanderlech wrote: Did you find any solution for getting object's methods and properties?
Yes. Create new UDT with:

Code: Select all

$class = get_class($params['object']);
echo '<h3>Class: '.$class.'</h3>';
$properties = get_class_vars($class);
  foreach ($properties as $key => $value) {
    echo "<i>Property: ".$key. ' : '.$value.'</i><br>';
  }
  
  $methods = get_class_methods($params['object']);
  for ($k=0; $k < sizeof($methods); $k++) {
    echo "Method: ".$methods[$k]. '<br>';
  }
and call it class_info.

Then call the tag from the page with giving object, like:

Code: Select all

{class_info object=$gCms}