vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Inserting code at the end of footer using plugins (https://vborg.vbsupport.ru/showthread.php?t=211127)

veenuisthebest 04-13-2009 09:07 PM

Inserting code at the end of footer using plugins
 
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 02: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
PHP Code:

$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 02:55 AM

Or you could edit the footer and put if after </body>.

PHP Code:

$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 03: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 03: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.


All times are GMT. The time now is 02:40 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01653 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete