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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
Sonya

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

Post 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
Last edited by Sonya on Mon Oct 12, 2009 6:08 pm, edited 1 time in total.
JeremyBASS

Re: How to get methods of object in smarty?

Post 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
Last edited by JeremyBASS on Fri May 22, 2009 7:24 pm, edited 1 time in total.
Sonya

Re: How to get methods of object in smarty?

Post 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 :)
User avatar
aleksanderlech
Forum Members
Forum Members
Posts: 113
Joined: Thu Jan 29, 2009 1:37 pm

Re: How to get methods of object in smarty?

Post by aleksanderlech »

Did you find any solution for getting object's methods and properties?

Regards
Aleksnader
---------------
olek@miniperfumeria.com
Sonya

Re: How to get methods of object in smarty?

Post 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}
Last edited by Sonya on Mon Oct 12, 2009 6:31 pm, edited 1 time in total.
Post Reply

Return to “Developers Discussion”