PEEL Shopping
Open source ecommerce : PEEL Shopping
StringLoader.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of Twig.
5  *
6  * (c) 2012 Fabien Potencier
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
12 {
16  public function getFunctions()
17  {
18  return array(
19  new Twig_SimpleFunction('template_from_string', 'twig_template_from_string', array('needs_environment' => true)),
20  );
21  }
22 
26  public function getName()
27  {
28  return 'string_loader';
29  }
30 }
31 
45 {
46  static $loader;
47 
48  if (null === $loader) {
49  $loader = new Twig_Loader_String();
50  }
51 
52  $current = $env->getLoader();
53  $env->setLoader($loader);
54  try {
55  $template = $env->loadTemplate($template);
56  } catch (Exception $e) {
57  $env->setLoader($current);
58 
59  throw $e;
60  }
61  $env->setLoader($current);
62 
63  return $template;
64 }
getLoader()
Gets the Loader instance.
getName()
{Returns the name of the extension.string The extension name}
Represents a template function.
setLoader(Twig_LoaderInterface $loader)
Sets the Loader instance.
getFunctions()
{Returns a list of functions to add to the existing list.array An array of functions} ...
twig_template_from_string(Twig_Environment $env, $template)
Loads a template from a string.
loadTemplate($name, $index=null)
Loads a template by name.
Loads a template from a string.
Definition: String.php:26
Stores the Twig configuration.
Definition: Environment.php:17

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:18 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.