PDA

View Full Version : Include other PHP files in Blocks


betadoor
02-15-2014, 03:54 PM
how can iclude other php files in forum block ?

$my_output = 'include('http://example.com/file.php')';
return $my_output;

^^ not work

kh99
02-15-2014, 06:11 PM
Well, you *could* try this (I removed one set of quotes):
$my_output = include('http://example.com/file.php');
return $my_output;

but that may not do what you want. Is the php file on your server?

cellarius
02-16-2014, 01:43 PM
you can't include a file into a variable like that, AFAIK. You probably could, if you would then use eval(), which won't work in the block either.

The OP either needs to rewrite the code in the input file to adapt it to the needs of the block environment OR he could try something like this:
<?php
ob_start();
include($file);
$result = ob_get_contents();
ob_end_clean();
?>

kh99
02-16-2014, 02:42 PM
you can't include a file into a variable like that, AFAIK.


You're right of course. I think you could if it were returning a string, but that's probably not the case.