PHP Classes

File: examples/test_pipe.php

Recommend this page to a friend!
  Classes of Jorge Castro   BladeOne   examples/test_pipe.php   Download  
File: examples/test_pipe.php
Role: Example script
Content type: text/plain
Description: Example script
Class: BladeOne
Standalone template engine that compiles into PHP
Author: By
Last change:
Date: 3 years ago
Size: 675 bytes
 

Contents

Class file image Download
<?php
/**
 * Copyright (c) 2016 Jorge Patricio Castro Castillo MIT License.
 */

use eftec\bladeone\BladeOne;

include
"../lib/BladeOne.php";

$blade=new BladeOne(null, null, BladeOne::MODE_DEBUG);
$blade->pipeEnable=true;

// adding a new method
$methodOne = static function ($arg=null) {
    echo
'It is the method 1 '.$arg;
};
$blade->directive('method1', $methodOne);

function
method2($arg=null) {
    return
'it is the method 2 '.$arg;
}



try {
   
//echo $blade->run("Test/hello.blade.php" // also works
   
echo $blade->run("Test.pipe", ["name" => "Jack Sparrow",'othername'=>'Popeye','date'=>new DateTime()]);
} catch (
Exception $e) {
    echo
$e->getMessage();
}