Login   Register  
PHP Classes
elePHPant
Icontem

File: teste.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Eduardo Henrique Molina da Cruz  >  Perfect Templates  >  teste.php  >  Download  
File: teste.php
Role: Example script
Content type: text/plain
Description: Examples of using the class.
Class: Perfect Templates
Template engine based on regular expressions
Author: By
Last change:
Date: 2003-12-13 10:13
Size: 1,503 bytes
 

Contents

Class file image Download
<?php

include("class.ptemplates.php");

$path "/home/eduardo/public_html/ps/develops/ptemplates/0.2/tpls/";

$template = new p_templates($path."general.tpl");
//print_r($template->vars);
//print_r($template->loops);
//print_r($template->templates);
//print_r($template->includes);
//print_r($template->ifs);
//exit;

$template->set_include("file1",$path."sub1.tpl");
$array = array("ededededededaaaaaaaaaaaaaaaaa","eduardo","igor","gustavo");
foreach (
$array as $name) {
$template->set_lvar("lp","age",$name);
$template->set_lvar("lp","url","teste-url");
}


$template->set_include("file2",$path."sub2.tpl");
$template->set_include("teste10",$path."sub4.tpl");


$template->set_var("teste1","camper");
$template->set_var("subteste","13");
$template->set_var("idade2","16");
$n 0;

for (
$i=0;$i<3;$i++) {
$template->set_lvar("loop1","idade","teste-idade");
$template->set_lvar("loop1","email","teste-email");
$template->set_lvar("loop1","name","teste-nome");
    for (
$j=0;$j<2;$j++) {
        
$template->set_lvar("inter","number",$j);
        
$template->set_lvar("inter","section","teste");

    }
    
$template->next_loop("inter");
}

$template->set_include("file5",$path."sub3.tpl");
$j 0;
for (
$i=0;$i<10;$i++) {
    if (
$j == 0)
    {
        
$template->set_lvar("bgcolor","random",1);
        
$j++;
    }
    else
    {
        
$template->set_lvar("bgcolor","random",2);
        
$j--;
    }
    
}

$template->set_var("pkg","slack");

//print_r($template->vars);
//print_r($template->loops);
//print_r($template->templates);
//exit;
$template->tprint();
?>