smarty->assign()

Creating and modifying plugins.
Post Reply
kidgoo
Regular
Posts: 71
Joined: Thu May 12, 2005 6:53 am

smarty->assign()

Post by kidgoo » Sat Jun 11, 2005 6:49 am

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: smarty->assign()

Post by garvinhicking » Sat Jun 11, 2005 11:56 am

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

kidgoo
Regular
Posts: 71
Joined: Thu May 12, 2005 6:53 am

Post by kidgoo » Sat Jun 11, 2005 5:50 pm

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

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking » Sun Jun 12, 2005 5:15 am

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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

Post Reply