View Full Version : Plugin / Hook not working?
Alan1
12-20-2005, 12:46 AM
Hi,
I am not sure if this is the right forum -
I have activated the plugin/hook system on my bulletin board and have added a new plugin which hooks at the location - sendmessage_start.
In the plugin php code I have entered something very simple echo 'hello world';
Now when I go back to my forum and click on the contact us, in theory the words hello world should be at the top but instead I get a blank page??
If I turn off the plugin, the page displays like normal. If I replace the echo code with phpinfo(); then it displays the usual phpinfo information and then below it the contact us form.
So why is it not working for something simple like an echo command, did I forget to activate soomething else?
Paul M
12-20-2005, 01:39 AM
Echo's are not always displayed;
Try
echo "Hello World" ; exit;
This will prove the plugin is working.
Alan1
12-20-2005, 01:57 AM
Hi Paul,
That works.
In regards to your comment that echo's do not always display, if that is so shouldn't the rest of the output be displayed and not just a blank page?
If I view the source of the blank page, this is all I get..
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD>
<BODY></BODY></HTML>
That means there either is a PHP error in your code or no output is being sent. (the code you're seeing is a blank page generated by your browser)
Alan1
12-20-2005, 08:36 PM
That means there either is a PHP error in your code or no output is being sent. (the code you're seeing is a blank page generated by your browser)
If that is the case then can you please tell me what is wrong with?
echo 'hello world';
output buffering will catch it. (and wont output it). You should NEVER directly output to the browser from a plugin anyway.
echo "hello world"; die;
joelabq
12-20-2005, 09:01 PM
The echo will not work in the main script, unless you use a vbulletin function to error out.
For a postbit, for instance, you can set a var like
$post[my_var] == "Hello world"
then in your postbit template, find the spot you want hello world to appear and put $post[my_var] in that template.
Joel
Alan1
12-20-2005, 09:26 PM
Ok that is fine with the echo bit then.
What I really want to do is change the logo header on the bulletin board (ie. replace the vBulletin logo etc.) with an include file but I have been told I can not do a call to an include <!--#include virtual ... in the style manager header area and I have instead been told to use the hook / plugin system.
Two questions -
1. For an include file do I just use the PHP include equivalent ie. include 'test.php';
2. The include file only contains HTML code, how do I get it to just display the HTML code in the include file.
Short answer: www.php.net -> search for output buffering.
If your file is static, its easier to just modify the header template, than messing around with even more output buffering.
joelabq
12-21-2005, 04:57 AM
Maybe we could help if we knew what you were trying to do?
joel
Alan1
12-21-2005, 05:12 AM
Hi Joel,
My post above pretty much explains what I want to do. I want to customise the header and footer files through the use of include files rather then directly copying all of the html out of my include files and embedding them straight into the template itself. I hope that makes sense.
joelabq
12-21-2005, 01:53 PM
It makes sense, however if the files are static, the work on a plugin for this wouldn't be worth the benefits.
Joel
Its not hard to achieve if you use output buffering. See php.net for instructions (or google for tutorials)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.