} } //function to write text to a file pointer. The function is called //params: file_pointer, text variable, value function loop_write($file, $txt, $num) { for ($x = 1; $x <= $num; $x++) { fwrite($file, $txt); } } $x = 1; $y = 0; $z = 0; $val = 1; //Getting all the file_pointers, read and write pointers list($read_file, $write_file) = file_open(); //$output is the array which consists of the text fields which is obtained from the xml schema file list($data, $apparatus, $tabs) = xml_to_object($read_file[0], $val); //$number is the number of pages which will be present in the easyauthor framework wizard $aim = $data[$z++]; //****************************************************Generating process starts*****************************************************// //echo $read_file[$x]; fwrite($write_file, $read_file[$x++] . $data[$z++] . $read_file[$x++] . $aim . "</h4>\n </div>\n <div id='rootwizard'>\n <ul>"); for ($y = 1; $y <= $tabs[0]; $y++) { fwrite($write_file, "<li><a href='#tab" . $y . "' data-toggle='tab'>" . $tabs[$y] . "</a></li>"); } fwrite($write_file, $read_file[$x++]); loop_write($write_file, $read_file[$x++], 1); fwrite($write_file, $read_file[$x++]); for ($y = 1; $y <= $apparatus[0]; $y++) { fwrite($write_file, "<button type='button'>" . $apparatus[$y] . "</button> Click to get a " . $apparatus[$y] . "<br><br>");
| PHParadise source code | |------------------------------------------------------------------------------- | | file: open file | category: file handling | | last modified: Mon, 20 Jun 2005 16:40:39 GMT | downloaded: Fri, 17 Sep 2010 13:17:33 GMT as PHP file | | code URL: | http://phparadise.de/php-code/file-handling/open-file/ | | description: | opens a file and returns the content as a string | ------------------------------------------------------------------------------*/ function file_open($filename) { if ($fp = @fopen($filename, "r")) { $fp = @fopen($filename, "r"); $contents = fread($fp, filesize($filename)); fclose($fp); return $contents; } else { return false; } } // use like $text = file_open('/home/papajohn/public_html/phpparser/dummy.txt'); echo "{$text}\n";