Page 1 of 1

smarty->assign()

Posted: Sat Jun 11, 2005 6:49 am
by kidgoo
Hello all,

I was wondering if there is any voodoo magic involved in getting access to the assign() function in $serendipity['smarty'] from a plugin. I've never used smarty templates before, and am trying to adjust the mood pluging to use them, but have run into some problems. $serendipity['smarty']->assign() complains that it's a call to a member function on a non-object. I have global'd $serendipity...

Thanks,
Brett

Re: smarty->assign()

Posted: Sat Jun 11, 2005 11:56 am
by garvinhicking
Hi!

Yes, accessing the $serendipty['smarty'] is possible. But it depends on the plugin hook you're using. In the frontend_configure hook it's not yet available, but i.e. the "display_entries" header has it available.

Also make sure you're using "global $serendipity" inside your plugin function...

Regards,
Garvin

Posted: Sat Jun 11, 2005 5:50 pm
by kidgoo
kidgoo wrote:I have global'd $serendipity...
garvinhicking wrote:Also make sure you're using "global $serendipity" inside your plugin function...
Yes, I have ;)

This explains a lot, though. Is it available in any of the backend hooks?

Btw, is this documented anywhere? The list of hooks on the main site seems to be out-dated...

Thanks,
Brett

Posted: Sun Jun 12, 2005 5:15 am
by garvinhicking
No, the backend hooks usually do not call and use Smarty Templating, so the object is not needed/used there.

Sadly yes the list of hooks is outdated, we could use some documenting help there. Finding them is easy by searching for "serendipity_plugin_api::hook_event" in the sourcecode files :-D

Regards,
Garvin