vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Adding PHP include file to header (https://vborg.vbsupport.ru/showthread.php?t=178476)

myadsl 05-07-2008 11:43 PM

Adding PHP include file to header
 
Hi there

Can you please point me in the right direction on how to add a PHP include file in our forum header?

I want to add <?php include('{Path to file}');?> to our header. I have a PHP file which produces some test output which I want to display?

Any help will be much appreciated.

Kirk Y 05-08-2008 01:00 AM

You'll have to utilize the plugin system and hook at global_start.

http://www.vbulletin.com/docs/html/t..._externalfiles

myadsl 05-08-2008 06:39 AM

Solved it thanks...

CypherSTL 05-08-2008 08:32 AM

Quote:

Originally Posted by myadsl (Post 1512411)
Solved it thanks...

How did you solve it?

I'm having a problem with one of my plug-ins that isn't working properly.

Plugin Code
Code:

ob_start();
require_once('sigStrip.php');
$sigStripPHP = ob_get_contents();
ob_end_clean();

And I'm calling this code in the postbit_legacy template using the following:
$sigStripPHP

A vB guy told me to use $globals['sigStripPHP'] to call it, but I get errors when I go to do that and no posts display.

The sigStrip.php for now just contains the following:
Code:

<?php
echo "Test";
?>

Thanks!

Kirk Y 05-08-2008 09:51 AM

No, you would call it with $sigStripPHP.

CypherSTL 05-08-2008 10:23 AM

Quote:

Originally Posted by Kirk Y (Post 1512527)
No, you would call it with $sigStripPHP.

I've tried that as well. It almost seems it's not even executing / including the phpfile when I do that, but when I check Debug mode, it does include it.

It just isn't displaying any of the output, in this case, the word "Test".

Marco van Herwaarden 05-08-2008 10:30 AM

Which hook location are you using for the plugin?

CypherSTL 05-08-2008 07:21 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1512557)
Which hook location are you using for the plugin?

global_start

Kirk Y 05-08-2008 08:28 PM

Just to cover all the bases, you are using $sigStripPHP in a template, right? If so, which?

CypherSTL 05-08-2008 08:32 PM

Quote:

Originally Posted by Kirk Y (Post 1513063)
Just to cover all the bases, you are using $sigStripPHP in a template, right? If so, which?

Yes. I have it entered into the postbit_legacy under the signature.

Kirk Y 05-08-2008 08:36 PM

Ah ha. The hat drops. You need to move your hook's location from global_start to postbit_display_start.

Because the postbits are output by a function, you're having a scope issue -- $sigStripPHP does not exist.

CypherSTL 05-08-2008 11:14 PM

Quote:

Originally Posted by Kirk Y (Post 1513069)
Ah ha. The hat drops. You need to move your hook's location from global_start to postbit_display_start.

Because the postbits are output by a function, you're having a scope issue -- $sigStripPHP does not exist.

Thanks. Changing the hook location fixed it.


All times are GMT. The time now is 07:11 AM.

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.01098 seconds
  • Memory Usage 1,733KB
  • 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
  • (2)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (12)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete