PHP Classes

File: testfilereplace.php

Recommend this page to a friend!
  Classes of markitos  >  filereplace  >  testfilereplace.php  >  Download  
File: testfilereplace.php
Role: ???
Content type: text/plain
Description: Test file.., how to work.
Class: filereplace
Replace signals using template file
Author: By
Last change:
Date: 20 years ago
Size: 1,235 bytes
 

Contents

Class file image Download
<? include ("clasefilereplace.php"); echo "<h4>Original Content</h4>"; $HFile = fopen (getcwd()."/templatetest.txt", "r"); while (!feof ($HFile)) {echo nl2br (fread ($HFile, 1024)); } fclose ($HFile); echo "<h4>Replaced Content using Replace method to get output</h4>"; $FileReplace = new filereplace (getcwd()."/templatetest.txt"); $FileReplace->AddReplace ("#_VALUE_SIGNAL_1_#", "VALUE SIGNAL ONE"); $FileReplace->AddReplace ("#_VALUE_SIGNAL_2_#", "VALUE SIGNAL TWO"); echo nl2br ($FileReplace->Replace()); unset ($FileReplace); echo "<h4>Replaced Content using Replace2File method to put content into new file</h4>"; echo "<h4>File: ".getcwd()."/outreplace2file.txt</h4>"; $FileReplace = new filereplace (getcwd()."/templatetest.txt"); $FileReplace->AddReplace ("#_VALUE_SIGNAL_1_#", "VALUE SIGNAL ONE"); $FileReplace->AddReplace ("#_VALUE_SIGNAL_2_#", "VALUE SIGNAL TWO"); $Passed = $FileReplace->Replace2File (getcwd()."/outreplace2file.txt"); if (!$Passed){ echo "<h1>Failed executing Replace2File method..., permissions ??</h1>"; } unset ($FileReplace); $HFile = fopen ("outreplace2file.txt", "r"); while (!feof ($HFile)) {echo nl2br (fread ($HFile, 1024)); } fclose ($HFile); ?>