vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Plugin / Hook not working? (https://vborg.vbsupport.ru/showthread.php?t=103338)

Alan1 12-20-2005 12:46 AM

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?

Paul M 12-20-2005 01:39 AM

Echo's are not always displayed;

Try

Code:

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>

merk 12-20-2005 05:34 AM

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

Quote:

Originally Posted by merk
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';

merk 12-20-2005 08:53 PM

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.

merk 12-20-2005 11:17 PM

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


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
  • Page Generation 0.01022 seconds
  • Memory Usage 1,729KB
  • 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_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete