Last active
December 28, 2015 01:59
-
-
Save EOM/7424686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Datos view Template | |
$data=array( | |
//... | |
); | |
//Load lib | |
require_once'libs/Twig/Autoloader.php'; | |
Twig_Autoloader::register(); | |
//config path template | |
$loader = new Twig_Loader_Filesystem($pathTmp); | |
// Set path cache | |
$twig = new Twig_Environment($loader, array( | |
'cache' => false, | |
//'cache' => $pathNewsLetters.'tmp', | |
'debug' => true | |
)); | |
// Con esto podemos tener la funcion base64_encode y base64_decode dentro del template | |
$twig->addFilter(new Twig_SimpleFilter('ebase64', 'base64_encode')); | |
$twig->addFilter(new Twig_SimpleFilter('dbase64', 'base64_decode')); | |
// Para llamarlo a la funciones desde dentro del templeta de Twig | |
// TemplateDemo.html.twig | |
// {{ varX|ebase64}} | |
// {{ varX|dbase64}} | |
$twig->render('TemplateDemo.html.twig', $data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment