View Full Version : if i create my own plugin, how do i call the plugin in a template?
zeroality
06-08-2010, 12:31 PM
I'm assuming you can't input php code directly into templates so I was wondering how I can call a plugin that I have created?
Lynne
06-08-2010, 01:31 PM
Plugins are called by hooks. If you look at the dropdown for hook locations in the plugin page, you'll see a ton of them. They are all located in the php code. So, if you pick "postbit_display_complete", you can do a search in your files and find that one of the places it is located in the file class_postbit.php around line 314:
// execute hook
($hook = vBulletinHook::fetch_hook('postbit_display_complet e')) ? eval($hook) : false;
So, you would be inserting code right there. You can see that several lines below that is where the postbit (or postbit_legacy) and the postbit_wrapper is rendered. So, if you want to insert something into those templates, that is a good hook location to pick.
You dont call plugins in templates, you render templates in plugins.
zeroality
06-27-2010, 11:18 AM
Alright, so say I create a plugin with the forumhome_complete hook, what would I insert into the forumhome template to execute that specific plugin? If I insert the code you have posted above, won't that execute every plugin associated with the hook?
What I'm wanting to do is take the (modified) code from the php file I have running for the news script at http://pokemontopaz.net/ and put that into a plugin then have it display that on the forum home template - to create a news box.
So basically, the code is pretty much already written and just needs to be inserted into a plugin. I'm just not sure how to call the plugin in the template without executing every plugin associated with the hook.
Lynne
06-27-2010, 02:09 PM
The code I posted above was showing you what the hooks look like in the existing code. That isn't code you would put in a plugin.
You don't call plugins in templates. Plugins can be used to render templates. Go download some modifications that do something similar to what you want and see what they did.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.