You could just append the files into a string, then show the string instead.


   $php = $DOCUMENT_ROOT . $php;
  if (ereg("(\.php)$",$php) && !ereg("\/\.\.", $php)){
     echo "<font class=\"source\">\n\n";
     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.


"Eriol" <[EMAIL PROTECTED]> wrote in message
> I've got the following bit of code to work in showing the actual PHP file
> code, but it doesn't show include() or require() files and I'd like it
> -------------- 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
> 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
> php code within head.php and foot.php..
> Is there a function I'm missing that would somehow allow me to add the
> 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..
> Take care.. peace..
> eriol

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to