Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2005, 12:46 AM
Alan1 Alan1 is offline
 
Join Date: Dec 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 12-20-2005, 01:39 AM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Echo's are not always displayed;

Try

Code:
echo "Hello World" ; exit;
This will prove the plugin is working.
Reply With Quote
  #3  
Old 12-20-2005, 01:57 AM
Alan1 Alan1 is offline
 
Join Date: Dec 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #4  
Old 12-20-2005, 05:34 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)
Reply With Quote
  #5  
Old 12-20-2005, 08:36 PM
Alan1 Alan1 is offline
 
Join Date: Dec 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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';
Reply With Quote
  #6  
Old 12-20-2005, 08:53 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
Reply With Quote
  #7  
Old 12-20-2005, 09:01 PM
joelabq joelabq is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #8  
Old 12-20-2005, 09:26 PM
Alan1 Alan1 is offline
 
Join Date: Dec 2005
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 12-20-2005, 11:17 PM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 12-21-2005, 04:57 AM
joelabq joelabq is offline
 
Join Date: Oct 2005
Posts: 15
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe we could help if we knew what you were trying to do?

joel
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:35 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.04235 seconds
  • Memory Usage 2,249KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete