You could just append the files into a string, then show the string instead.
Like
if(strlen($php)>0){
$php = $DOCUMENT_ROOT . $php;
if (ereg("(\.php)$",$php) && !ereg("\/\.\.", $php)){
$show=file("head.php");
$show.=file("$php");
$show.=file("foot.php");
echo "<font class=\"source\">\n\n";
show_source("$show");
echo "\n\n</font>\n";
}
This would give you the full source, and would need to be in addition to
actually 'requiring' the files.
If your show_source() function is set to take a file, you'd need to change
it to take a string instead. Or save $show as a file and send the name or
handle (I'm not sure which it expects) to the function.
Mike
"Eriol" <[EMAIL PROTECTED]> wrote in message
018801c24257$9bf66780$f32d5b40@eriol">news:018801c24257$9bf66780$f32d5b40@eriol...
> I've got the following bit of code to work in showing the actual PHP file
source
> code, but it doesn't show include() or require() files and I'd like it
to..
>
> -------------- source.php --------------
>
> if(strlen($php)>0){
> $php = $DOCUMENT_ROOT . $php;
> if (ereg("(\.php)$",$php) && !ereg("\/\.\.", $php)){
> require("head.php");
> echo "<font class=\"source\">\n\n";
> show_source("$php");
> echo "\n\n</font>\n";
> require("foot.php");
> }
> else{
> require("head.php");
> echo "<font class=\"s\">\n";
> echo " There's been an error..\n";
> echo "</font>\n";
> require("foot.php");
> }
> exit;
> }
>
> ----------------------------
>
> I've checked the manual and google, but I'm not too sure the keywords I'd
used
> were correct as I didn't find any results.. I looked at highlight_file()
but it
> would seem to cause the same output as show_source() neglecting to include
the
> php code within head.php and foot.php..
>
> Is there a function I'm missing that would somehow allow me to add the
head.php
> and foot.php code within the source code output page? Will I need to add
> something to the head.php and foot.php files to have them included?
>
> I'm a bit of a php newbie, so sorry if my terminology isn't correct..
TIA..
>
> Take care.. peace..
> eriol
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php