vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Including a PHP file in a widget (https://vborg.vbsupport.ru/showthread.php?t=242760)

Crimm 05-18-2010 02:44 AM

Including a PHP file in a widget
 
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/showt...-php-in-Widget

Code:

// 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:

Quote:

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)

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


I'm getting the same error.

Quote:

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 08:16 AM

What's happening in your external php file?
Paste youre code here

Crimm 05-18-2010 12: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 03: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 04:33 PM

Thank you Frank.

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


All times are GMT. The time now is 09:55 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.01834 seconds
  • Memory Usage 1,719KB
  • 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
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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