PHP Classes

PXML: Template engine that compiles XML tags in PHP code

Recommend this page to a friend!
  Info   View files Documentation   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2014-07-04 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 287 All time: 7,085 This week: 1,099Up
Version License PHP version Categories
pxml 1.0MIT/X Consortium ...5.0XML, PHP 5, Templates
Description Author

This class is a template engine that compiles XML like tags in PHP code.

It loads a template file with certain tags and replaces them by PHP code that will be executed to generate the processed template output.

Currently it supports tags that are replaced by raw PHP code, for, foreach and while loops, conditions and echo statements.

Picture of Mohammed Al Ashaal
  Performance   Level  
Name: Mohammed Al Ashaal <contact>
Classes: 7 packages by
Country: Egypt Egypt
Age: 23
All time rank: 134011 in Egypt Egypt
Week rank: 535 Up11 in Egypt Egypt Equal
Innovation award
Innovation award
Nominee: 2x

Winner: 1x



<img src="" /> <br /> A smart tiny and lightest OO php templating system . <br /> Only it replaces some words with others ( uses "str_ireplace()" ) . <br /> - No regex . <br /> - No complex code . <br /> - Very light (the lightest) . <br /> - Write php as xml/html . <br /> - Self Container for ( vars & methods ) . <br /> - Object Oriented . <br />



Config it:


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

// start it
$pxml = new pxml;

// ad your own replacements ?
    '(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>
    <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>
        <print> "HI 3" </print>
    <br />
    <for>$i=0; $i <= 5; ++$i</for>
    <br />
    <php>$x = 4</php>
    <while>$x < 5</while>
    <print>$x, " - " , "HI"</print>
  Files folder image Files  
File Role Description
Plain text file pxml.php Class Class source
Accessible without login Plain text file Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,085
This week:1,099Up