![]() |
Plugin / Hook not working?
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? |
Echo's are not always displayed;
Try Code:
echo "Hello World" ; exit; |
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)
|
Quote:
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; |
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 |
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. |
Maybe we could help if we knew what you were trying to do?
joel |
All times are GMT. The time now is 02:03 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|