[ Index ] |
PHP Cross Reference of Yamoon 0.9.0 |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * File.php - This is not a class, only a set of functions. Including 5 * this file you two file methods to manage files and templates. 6 */ 7 8 /** 9 * printTemplate - get the contents of a PHP file and store it into 10 * a variable. 11 * 12 * param $file The filename to open 13 * return $content The file content after PHP parsing 14 */ 15 function printTemplate ($filename) { 16 ob_start(); 17 include($filename); 18 $content = ob_get_contents(); 19 ob_end_clean(); 20 ob_end_flush(); 21 return $content; 22 } 23 24 /** 25 * write - print the $content into $file. 26 * 27 * param $file The filename to open 28 * param $content The file content to write 29 */ 30 function write ($filename, $content) { 31 if (!$handle = fopen($filename, 'w')) { 32 echo "Cannot open file ($filename)"; 33 exit; 34 } 35 if (fwrite($handle, $content) === FALSE) { 36 echo "Cannot write to file ($filename)"; 37 exit; 38 } 39 fclose($handle); 40 } 41 42 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sat Feb 19 17:29:53 2005 | Cross-referenced by PHPXref 0.6 |