Location: PHPKode > scripts > Simple Tags > simple-tags/example.php
<?php
require_once 'SetsConfig.php';

class Page {
	
	public $result = '';

	public function render() {
		$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
		
		switch($action) {
			case 'convert':
				$this->convert();
				break;
			default :
				$this->toHTML();
		}
	
	}
	
	public function convert() {
		require_once 'classes/Parser/Parser.php';
		
		$parse = new Parser();
		$parse->setData($_REQUEST['string']);
		$this->result = $parse->parseResult();
		
		return $this->toHTML();
	}

	public function toHTML() {
echo <<<HTML
<body>
	<table width="100%" align="left">
		<form action="{$_SERVER['PHP_SELF']}?action=convert" method="post">
		<tr>
		<td width="25%">{$this->result}</td>
		</tr>
		<tr>
			<td width="15%">TEST STRING:</td>
			<td>
			<textarea name="string" rows="3" cols="35">
				string [test1] stringstring [test2] string [test3]
			</textarea>
			</td>
		</tr>
		<tr>
		<td>
		<input type="submit" value="TEST" /><br />
		<input type="button" onclick="window.location.href='example.php'" value="RELOAD" />
		<td>
		</tr>
		</form>
	</table>
</body>
HTML;
	}
}

$document = new Page();
$document->render();

?>
Return current item: Simple Tags