All Projects → alash3al → pxml-tpl

alash3al / pxml-tpl

Licence: other
PHTML a smart tiny oo PHP HTML style template system, no more regex and no more large code, packags, ...

Programming Languages

PHP
23972 projects - #3 most used programming language

PXML TPL


A smart tiny and lightest OO php templating system .
Only it replaces some words with others ( uses "str_ireplace()" ) .

  • No regex .
  • No complex code .
  • Very light (the lightest) .
  • Write php as xml/html .
  • Self Container for ( vars & methods ) .
  • Object Oriented .

Usage

Config it:

<?php

// load it
require_once 'path/tp/pxml.php';

// start it
$pxml = new pxml;

// add your own replacements ?
$pxml->add(array(
    '(php):'    =>  ' <?php ',
    ':(php)'    =>  ' ?> '
));

// render a file (and pass vars "optional")
$pxml->render('path/to/file.html', array('var' => 'value'));

An PHTML file

    <h1> <print>$c</print> </h1>
    <php> $this->alert = 'hi' </php>
    <print> $this->alert </print>
    
    <br />
    
    <php> $array = array( 1,2,3,4 ); </php>
    <foreach> $array as $v </foreach>
        <print> $v </print>
    </endforeach>
    
    <br />
    
    <php> $array = array( 1,2,3,4 ); </php>
    <if> !empty($xxx) </if>
        <print> "HI 1" </print>
    <elseif> !empty($yyyy) </elseif>
        <print> "HI 2" </print>
    <else> 
        <print> "HI 3" </print>
    </endif>
    
    <br />
    
    
    <for>$i=0; $i <= 5; ++$i</for>
    <print>$i</print>
    </endfor>
    
    <br />
    
    <php>$x = 4</php>
    <while>$x < 5</while>
    <print>$x, " - " , "HI"</print>
    <php>++$x</php>
    </endwhile>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].