PDA

View Full Version : How to add a plugin for use on the forumhome page??


siliconfinance
01-10-2011, 07:04 PM
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 (https://vborg.vbsupport.ru/showthread.php?p=1300336#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
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

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 1294702744 at 1294702744 ---------------

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

Thank you!!!