vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   if i create my own plugin, how do i call the plugin in a template? (https://vborg.vbsupport.ru/showthread.php?t=244215)

zeroality 06-08-2010 12:31 PM

if i create my own plugin, how do i call the plugin in a template?
 
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:
PHP Code:

        // execute hook
        
($hook vBulletinHook::fetch_hook('postbit_display_complete')) ? 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.


All times are GMT. The time now is 12:07 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.00962 seconds
  • Memory Usage 1,718KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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