PDA

View Full Version : Inserting code at the end of footer using plugins


veenuisthebest
04-13-2009, 10:07 PM
How do we do it?

Say I created a simple plugin on global_complete hook with:-

echo "Hello";

Now when I view the page its inserted at the top, even above doctype. I want Hello to be printed at the bottom most of the site (above </body>) using plugins. I don't want to do any find and replace for this small purpose.

Thanks

Dismounted
04-14-2009, 03:52 AM
You're going to have to use a search and replace - how else do you want to do it? (Template hooks don't cover that "low".)

global_complete
$vartext = str_replace('</body>', 'Hello</body>', $vartext);

Edit: Forgot to mention that $vartext is an actual vBulletin variable for the output at print_output().

Excalibur82
04-14-2009, 03:55 AM
Or you could edit the footer and put if after </body>.

$var = echo "Hello";

Then just place $var where you want in the footer. Otherwise you'll have to do as Dismounted suggested.

Dismounted
04-14-2009, 04:06 AM
Your code wouldn't work - echo() does not return a result. Anyway, if you wanted to do it like that, why wouldn't you just place "Hello" in the template itself?

veenuisthebest
04-14-2009, 04:14 AM
okay problem solved. I added a new template hook at the end of footer. Footer template hooks work only from global_start hook.