Re: Re: showing source

From: Date: Fri, 18 May 2007 15:32:01 +0000
Subject: Re: Re: showing source
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-255143@lists.php.net to get a copy of this message
On 5/18/07, Steve <steve@deported.net> wrote:
Not that it really matters in this scenario, but if you rename a file to .phps you should be able to navigate to it in a web browser and have nice, highlighted syntax. It's pretty nice for internally viewing a file, but obviously I wouldn't recommend doing this with live files that contain sensitive information.
Or just a symlink from .phps to .php for the file :) Tijnema
"James Lockie" <bjlockie@lockie.homeunix.net> wrote in message news:464D3EB7.5050109@lockie.homeunix.net... This almost works but all my < and > are replaced with "".
       // open this file to show the source
       if (($fh = fopen( __FILE__, 'r' )) === FALSE){
           die ('Failed to open source file (' . $_FILE_ . ') for
reading!');
       } else {
           $tags  = array( "<", ">" );
           $safe_tags = array( "\\<", "\\>" );
           print "<pre>\n";
           // read the file line by line
           while (! feof( $fh )) {
               $currentLine = fgets( $fh, 255 );
               $noTags = str_replace( $tags, $safeTags, $currentLine );
               print $noTags;
           }
           fclose( $fh );
           print "</pre>\n";
       }
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#255143) next »