PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Bogdan  >  Simple Tags  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: demonstrate
Class: Simple Tags
Template engine that replaces tags within brackets
Author: By
Last change:
Date: 6 years ago
Size: 1,147 bytes
 

Contents

Class file image Download
<?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();

?>