vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   How to add a plugin for use on the forumhome page?? (https://vborg.vbsupport.ru/showthread.php?t=256911)

siliconfinance 01-10-2011 07:04 PM

How to add a plugin for use on the forumhome page??
 
I created a template that includes a banner rotator script which I incorporate in my vBulletin ad templates via plugin. I obtained the plugin code here:
https://vborg.vbsupport.ru/showt...36#post1300336

This plugin works when I place the banner template into my ad_header_end template. Yay!

I recently decided that I would also like to display banners on the FORUM HOME page between forums. I have isolated the relevant vbulletin FORUMHOME template (forumhome_forumbit_level2_post) that I would like to incorporate the banner template, but the plugin will not execute when I insert my banner rotator template into that template.

I assume I need to create a new plugin with a different hook location in order to fetch the template that includes the banner rotator script.

I have searched google and vbulletin.org extensively without success.

Any guidance someone can provide would be greatly appreciated.

Lynne has been very helpful over at vb .com but I think I need some input from some more experienced folks.

kh99 01-10-2011 08:10 PM

Try making a plugin using hook location forumbit_display. You may not have to duplicate all the code, you might just be able to declare your variables as global in the new plugin. (Since the forumhome templates are eval'd in a function, they won't be able to access variables from elsewhere unless there's a global statement).

siliconfinance 01-10-2011 08:44 PM

Quote:

Originally Posted by kh99 (Post 2147221)
Try making a plugin using hook location forumbit_display. You may not have to duplicate all the code, you might just be able to declare your variables as global in the new plugin. (Since the forumhome templates are eval'd in a function, they won't be able to access variables from elsewhere unless there's a global statement).

Since I am new to this, can you guide me as to what code to include in the plugin?

kh99 01-10-2011 08:53 PM

I can't tell you exactly since it depends on what your plugin does and what your template changes are. But I think whatever variables you are trying to put in the template should be declared as global. For instance if you're trying to display an ad by putting $ad in the template somewhere, then you'd put

Code:

global $ad;
as the plugin code. (That is, a new plugin using hook location forumbit_display and only that one line of code).

ETA: if you haven't created a plugin before: Go to "Plugins and Products" in the admin comtrol panel, choose "Add New Plugin". Choose the hook location and make up a title (so you'll remember what it is later). Put the code in the big text area, select "Yes" to make it active, and save.

siliconfinance 01-10-2011 09:02 PM

Here is what I have.

I have banner code in a custom template

I want that template to be incorporated in this template (via a plugin): forumhome_forumbit_level2_post

I am trying to figure out how that plugin needs to be written in this thread.

--------------- Added [DATE]1294702744[/DATE] at [TIME]1294702744[/TIME] ---------------

Thank you very much. I added the ';' that you added and everything works now!

Thank you!!!


All times are GMT. The time now is 06:51 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.01015 seconds
  • Memory Usage 1,725KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_quote_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