PDA

View Full Version : Including a PHP file in a widget


Crimm
05-18-2010, 03:44 AM
Okay I've been playing with this for a few of my mods to update them from 3.X to 4.X and I'm having issues with the CMS. I'm trying to include PHP files (Local to the forum) in the widget. I've been doing some searching and some copy/pasting.

I'm getting tired, so a break from the PC may be what I need, but I figured I would post and see if some wonderful person would stop by and help me.

Here's what I've tried.

I've tried flat out includes:
http://www.vbulletin.com/forum/showthread.php?334064-How-do-I-include-php-in-Widget

// UNTESTED
ob_start();
include("path/to/your.php");
echo "<br />\n";
$output .= ob_get_contents();
ob_end_clean();

but I'm getting a Bootstrap error:

Fatal error: Cannot redeclare class vB_Bootstrap_Forum in /XXXXXX/class_bootstrap.php on line 1579

Now, I've also tried including the PHP file using preRegistered vairables in plugins and styles by combining my own article:

https://vborg.vbsupport.ru/showthread.php?t=242454

:P (Thanks for approving it Lynne (https://vborg.vbsupport.ru/member.php?u=65230))

and this article: https://vborg.vbsupport.ru/showthread.php?t=236245


I'm getting the same error.

Fatal error: Cannot redeclare class vB_Bootstrap_Forum in /XXXXXX/class_bootstrap.php on line 1579

It seems that I can't include a PHP file in a widget... Any help? Searches on that error specifically aren't producing very much.

I'm going to take a break and play some Halo Reach and get some frustration out. If anyone would be so kind as to drop me a tidbit to work from; that would be great.

ragtek
05-18-2010, 09:16 AM
What's happening in your external php file?
Paste youre code here

Crimm
05-18-2010, 01:06 PM
It's far too complicated yo examine it that way. I was thinking about isolating the php file last night.

I'm going to try a few things this am. I'll be back shortly.

Frank T
10-08-2010, 04:00 AM
I think I figured this out. It's a bug in vBulletin. Edit "global.php" and change the following:
require('./includes/class_bootstrap.php');

Change that to:
require_once('./includes/class_bootstrap.php');

I was having the same exact problem. I noticed that the problem disappeared after I disabled one of my own customizations (mine was coded correctly). So I tracked it down further to the problem above.

Crimm
10-08-2010, 05:33 PM
Thank you Frank.

I'll give this a shot when I get back into my vB mods soon-ish.