The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi,
I'm following the instructions found at the following link to add a plugin to my forum. http://www.vbulletin.com/forum/showthread.php?t=173937 I'm trying to add the current poll script found at the following link to the side bar. http://www.joedolson.com/poll-v2/ I have used the following code in the plugin php code box: Code:
ob_start();
include('../poll/currentpoll.php');
$currentpoll = ob_get_contents();
ob_end_clean();
Code:
$currentpoll Here are the contents of currentpoll.php (the file being included in the plugin code) Code:
<?php
require_once("jdp_functions.php");
require_once("mysql_connect.php");
// Define this poll
$pollname = "default_poll"; // Name of referenced poll.
global $formpath;
$formpath = "/poll"; // Absolute path to poll. No final slash.
global $ctype;
$ctype = "p"; // chart type (regular pie chart = 'p', 3d pie chart = 'p3'
include("poll.php");
?>
Any ideas? Could there be a conflict with using the the settings within mysql_connect.php which use the same settings as vbulletin? I don't think there is because the variable names are different but figured I'd ask. TIA, Scott |
|
#2
|
|||
|
|||
|
Try forcing the includes to use the correct directory:
Example. Use: PHP Code:
PHP Code:
|
|
#3
|
|||
|
|||
|
Quote:
directory structure is (just in case there's any confusion): /root/poll /root/vbulletin I used ../poll/poll.php and I don't get any errors but I also don't get the poll to display. I'll keep working on it but any more ideas would be appreciated. Thanks, Scott --------------- Added [DATE]1219161740[/DATE] at [TIME]1219161740[/TIME] --------------- Check that, got it working! I switched the hook during trouble shooting from "global_start" to "forum_complete" and forgot to switch it back. Thanks for the help! |
|
#4
|
|||
|
|||
|
When the plugin is executed it will have the vBulletin installation directory as current directory. Including a file in another directory (include('../poll/currentpoll.php')
does not chdir() to that directory, so the included script will still be running "from" the vB directory. So if your script includes "poll.php" first the current working directory (ie. your vB installation directory) will be searched first for the a script with this name and it will find the vBulletin poll.php file.
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|