display_code_file_contents.php

<?php

class ShowCode {

             public function 
__construct($file){
               
$this->file $file;
             }
             
             public function 
show()
             {
               
$parts explode('/',$this->file); // for files in directories such as '/path/to/file.php'
               
$num count($parts);
               print 
"<h2>".$parts[$num-1]."</h2>"// returns file name without path such as 'file.php'
               
try {
                    
highlight_string(file_get_contents(($this->file),ENT_QUOTES));
               } catch (
Exception $e) {
                 echo 
$e->getMessage();
               }
             }

}
?>

Paul's Code Library

Categories

Home

AJAX

classes

database_functions

date_functions

file_functions

googlevideo_and_youtube_api

htaccess

image_functions

string_functions