PDA

View Full Version : PHP includes not working


apimag
01-06-2011, 04:49 AM
Trying to get file includes working, but without any luck. Have followed instructions here:
http://www.vbulletin.com/docs/html/templates_externalfiles

So, in short, have created a php file, "example_include.php" with the contents:
<?php
echo 'Include success!!';
?>


1. Dropped this into the forum root directory.

2. Created new plug-in:

ob_start();
include('example_include.php');
$includedphp = ob_get_contents();
ob_end_clean();

Selected "global_start"
Checked plug-in is active (and plugin feature generally is enabled).

3. Added {vb:raw includedphp} to the header under common templates.

4. Enabled debug to view that the file has in fact been included:
Included Files (15):

* ./index.php
* ./forum.php
* ./global.php
* ./includes/class_bootstrap.php
* ./includes/init.php
* ./includes/class_core.php
* ./includes/config.php
* ./includes/functions.php
* ./includes/class_hook.php
* ./example_include.php
* ./includes/functions_bigthree.php
* ./includes/functions_forumlist.php
* ./includes/functions_calendar.php
* ./includes/functions_notice.php
* ./includes/class_friendly_url.php
But I can't see the test message in the included php file anywhere (have searched source).

Any ideas out there please?

WEBDosser
01-06-2011, 05:12 AM
don't you need the path adding?..

ForumsMods
01-06-2011, 09:16 AM
First, you need to pre-register the variable.

BirdOPrey5
01-06-2011, 01:43 PM
Just for general info, in the future a question like this is better fit for the "VB4 Programming Discussion" Forum (Here (https://vborg.vbsupport.ru/forumdisplay.php?f=252)) than the "Requests" forum it's in now.

apimag
01-06-2011, 09:51 PM
Thanks ForumsMods, that's cracked it. Really had me stumped as there was nothing about this in the online manual.

Sorry BirdOPrey5 - feel free to move it to the appropriate discussion. Can vBulletin do that?