PHP Classes

File: test/test-delims.php

Recommend this page to a friend!
  Classes of Nikos M.   Grammar Template   test/test-delims.php   Download  
File: test/test-delims.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Grammar Template
Template engine in PHP and other languages
Author: By
Last change:
Date: 3 years ago
Size: 550 bytes
 

Contents

Class file image Download
<?php
include "../src/php/GrammarTemplate.php";
function
echo_($s='')
{
    echo
$s . PHP_EOL;
}

echo_('GrammarTemplate.VERSION = ' . GrammarTemplate::VERSION);
echo_();

$tpl = "\\\\[var]\n\\[[var2]\\][[ \\[[var2]*\\]]][[# comment #]]\n[foo]\\?[foo] ?";

$grm = new GrammarTemplate($tpl, array('[',']','[[',']]'), true);

echo_("input template:");
echo_($tpl);

echo_( );

echo_("output:");
echo_($grm->render((object)array(
   
"foo" => "foo",
   
"var" => "var",
   
"var2" => array(
       
"var1",
       
"var2",
       
"var3"
   
)
)));