The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How include two php file using hook location global_start
I want to ask how to include two php files separately?using the hook location global start?
Right now, I have two plug-in code namely firstplugin and secondplugin with same code. See below: firstplugin code: ob_start(); include('firstplugin.php'); $first= ob_get_contents(); ob_clean(); secondplugin code: ob_start(); include('secondplugin.php'); $second= ob_get_contents(); ob_clean() Now, when I activate this two plug-in nothing shows up except for a white backgroud in the browser. Now, when I deactivate either one of the two it works. I run this two plug-ins in one page. I want them to show up. How can I achieve this?How can I include two php files with same code and the same hook location?Need Help ASAP... |
#2
|
|||
|
|||
The second plugin you posted is missing a ';' at the end. Maybe that was just an error copying it here, but if not that may be what's causing the white page. Otherwise, it's probably that it can't find the file you're telling it to include.
To get the output to display, you need to include it in a template in some way. One way is to pre-register it to a template, then edit the template and insert it where you want it to appear. So for example, if you wanted your file to appear in the header of every page, your first plugin might look like this: ob_start(); Code:
include('firstplugin.php'); $first= ob_get_contents(); ob_clean(); vB_Template::preRegister('header', array('first' => $first)); Then you'd have to edit the header template and insert {vb:raw first} where you want it to appear. Note that if you use vB_Template:reRegister to insert something in the navbar, headinclude, header, or one of the ad templates, then you need to use hook parse_templates for your plugin. If you want to know what template to edit, one way to figure that out is to turn on "Add Template Name in HTML Comments" by going to Settings > Options > General Settings in the admincp. Then if you view the html source of a vbulletin page in your browser, you should see comments telling you when specific templates begin/end. |
#3
|
|||
|
|||
@kh99 when I add the semicolon at the end its still the same happend nothings appears. I already preRegister the template already.
But when I activate one by one it works but when I activate the two nothing appears and it shows me white background. |
#4
|
|||
|
|||
Oh, I see now. Sorry, I didn't read your post carefully. Anyway, maybe try using ob_end_clean() in place of ob_clean().
|
#5
|
|||
|
|||
@kh99 I already use that also but nothing happens. I really dont know what's the reason.
--------------- Added [DATE]1426298238[/DATE] at [TIME]1426298238[/TIME] --------------- Is it possible to create plug-in with the same hook location?and execution order?with the same products? I am using the hook location global_start. |
#6
|
|||
|
|||
Yes, it's ok to do that. If the execution order is the same, I don't think you'll know for sure which one will run first, but it doesn't look like that should matter.
The problem could be in the other code in the plugin, or in the include files. Maybe they conflict somehow, like if they define the same function. If that's the problem, then you might have to make changes to the included files. |
#7
|
|||
|
|||
I got it working @kh99, thanks for your time and giving me some tips on how to check it. Yup, there is a conflict in function and I change it and right now its working perfect. Thanks dude.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|