PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
  Classes of Rafael Rodriguez  >  Div PHP Template Engine  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example
Class: Div PHP Template Engine
Template processing engine that replaces tags
Author: By
Last change: new repo
Date: 2 years ago
Size: 650 bytes
 

Contents

Class file image Download
<?php

/**
 * Div PHP Template Engine Example
 */

// Include the lib
include "div.php";

// Custom function
function t($word)
{
   
$dict = array('ejemplo basico' => 'basic example');

    if (isset(
$dict[strtolower($word)]))
        return
$dict[strtolower($word)];

    return
$word;
}

div::setAllowedFunction("t");

// Custom parser/subparser
function a($href)
{
    return
'<a href = "' . $href . '">' . $href . '</a>';
}

div::setSubParser("a");

// Output
echo new div("example.tpl", array(
   
"title" => "Ejemplo basico",
   
"year" => "2015",
   
"links" => array("Core" => "http://github.com/rafageist/div", "Extras" => "http://github.com/rafageist/div-extras")));