Login   Register  
PHP Classes
elePHPant
Icontem

File: README

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of markitos  >  filereplace  >  README  >  Download  
File: README
Role: ???
Content type: text/plain
Description: README file
Class: filereplace
Replace signals using template file
Author: By
Last change:
Date: 2002-07-04 07:42
Size: 1,618 bytes
 

Contents

Class file image Download
README FILE CLASS FILEREPLACE
-----------------------------

FileReplace is a small class create to do signal's replacements,
using a template file.

Use this class is very easy.
I'll explain yours methods, but.., the best way to use is view the
test file.

The template file are called: templatetest.txt.
Template File like this:

--- cut here ---
TEST FILE CLASEFILEREPLACE

SIGNAL ONE: #_VALUE_SIGNAL_1_#
SIGNAL TWO: #_VALUE_SIGNAL_2_#

END OF FILE
--- cut here ---

The signal are:

#_VALUE_SIGNAL_1_#

and 

#_VALUE_SIGNAL_2_#

I would like replace each signal, putting some random values:

	// contructor. one parameter: template file
	$FileReplace = new filereplace ("templatetest.txt");

	// Add value's signal to replace...
	$FileReplace->AddReplace ("#_VALUE_SIGNAL_1_#", "VALUE SIGNAL ONE");
	$FileReplace->AddReplace ("#_VALUE_SIGNAL_2_#", "VALUE SIGNAL TWO");
	
	// and finally..., we can call 2 methods:
	// Replace: Return full content of template file with new signals values
	// Replace2File: create a new file. The content of this file are 
	//							Replaces's output method :)
	
	$Content = $FileReplace->Replace();
	
	// or
	
	$FileReplace->Replace2File ("outputfile.txt");
	
And nothing else...
You can remove a signal before replace method are called using RemoveReplace method like:

	// add replace
	$FileReplace->AddReplace ("SIGNAL", "VALUE SIGNAL");
	
	// remove preview replace
	$FileReplace->RemoveReplace ("SIGNAL");

For more info or questions mailme: contacto@markitos.net

;.
;. www.markitos.net
;. mArKitos 2oo2
;.