Creating new event hooks

Discussion corner for Developers of Serendipity.
Post Reply
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Post by wesley »

Yes, it's possible but unless the development team accepts it as official
it'll have to be a proprietary thing... the plug-in will only work with the
theme that has the modified index.tpl file.

Look at the end of entries.tpl for how 'entries_footer' hook was implemented.
Speaking of entries_footer, I don't need to put something so far below that
it needs to be right next to </body> tag, so I use this hook instead. This
hook places the code at the end of the 'contents' area of the page and I
made a plug-in that lets you put an HTML nugget (including javascript)
there. Apparently this hook isn't all that well documented yet, IMO.
I make s9y plugins, too.
My s9y blog depends on them. :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

You can only call your "own" hooks via Smarty, you need to add a "hookAll='true'" parameter to the serendipity_hookPlugin call. Otherwise only core plugin hooks are allowed.

See http://www.s9y.org/index.php?node=78 for details on that. :)

However you nearly have me pushed to add that "frontend_footer" file to the core. Wesley, if you're reading this, would you like to add that to the bundled and additional themes?

To make it a "core plugin hook" you need to edit the static $hookable array in serendipity_smarty_hookPlugin() in include/functions_smarty.inc.php ...

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/
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Post by wesley »

I'll take a look into it.

EDIT: Okay, I'll be testing modification of two files and have it committed
after testing turns out okay. For the testing I'll be using that nugget plug-in
and I'm in the process of adding another nugget location, and I plan to
commit everything at once, so it'll take a while.
I make s9y plugins, too.
My s9y blog depends on them. :)
wesley
Regular
Posts: 197
Joined: Sun Jul 10, 2005 11:15 am
Contact:

Post by wesley »

Changes have been committed. However, due to the changes in the way
function_smarty.inc.php works in version 0.9, it seems that those using
0.8x cannot simply copy only this file from the SVN trunk and replace the
existing one in their installations. Doing so breaks the Archives page.
The 'view full' and 'view topics' links don't appear.

Specifically, it seems to be because of changes in revision 108 and 114.
Removal of:
'CONST' => get_defined_constants(),
from revision 114 (see here) is the reason why Archives page breaks,
according to my testing. Adding this line seems to restore functionality.

Since I only use 0.8.2, I'm assuming that the Archives page won't break
if all the /include files in 0.9 trunk are used together. But I'm not sure.
I make s9y plugins, too.
My s9y blog depends on them. :)
Post Reply