Created
November 8, 2012 20:05
-
-
Save LionsAd/4041188 to your computer and use it in GitHub Desktop.
Markup for Twig features and compiled
This file contains hidden or 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
| === blocks.twig | |
| {% block sidebar %} | |
| Right | |
| {% endblock %} | |
| === test-base.twig | |
| <side> | |
| {% block sidebar %}Sidebar{% endblock %} | |
| </side> | |
| --- Header --- | |
| {% block myname %} | |
| Hola {{ name }}! | |
| {% endblock %} | |
| === test-include.twig | |
| --- Nice World --- | |
| Hallo {{ name }}! | |
| --- End World --- | |
| === test.twig | |
| {% extends "test-base.twig" %} | |
| {% use "blocks.twig" with sidebar as parent_sidebar %} | |
| {% block myname %} | |
| Hello {{ name }}! | |
| {% include "test-include.twig" %} | |
| {% endblock %} | |
| {% block sidebar %} | |
| {{ block('parent_sidebar') }} | |
| {{ parent() }} | |
| Left | |
| {% endblock %} | |
| ---------- | |
| <?php | |
| /* test.twig */ | |
| class __TwigTemplate_0043bd27409f785f4089bcb3347fe40b extends Twig_Template | |
| { | |
| public function __construct(Twig_Environment $env) | |
| { | |
| parent::__construct($env); | |
| $this->parent = $this->env->loadTemplate("test-base.twig"); | |
| $_trait_0 = $this->env->loadTemplate("blocks.twig"); | |
| // line 2 | |
| if (!$_trait_0->isTraitable()) { | |
| throw new Twig_Error_Runtime('Template "'."blocks.twig".'" cannot be used as a trait.'); | |
| } | |
| $_trait_0_blocks = $_trait_0->getBlocks(); | |
| $_trait_0_blocks["parent_sidebar"] = $_trait_0_blocks["sidebar"]; unset($_trait_0_blocks["sidebar"]); | |
| $this->traits = $_trait_0_blocks; | |
| $this->blocks = array_merge( | |
| $this->traits, | |
| array( | |
| 'myname' => array($this, 'block_myname'), | |
| 'sidebar' => array($this, 'block_sidebar'), | |
| ) | |
| ); | |
| } | |
| protected function doGetParent(array $context) | |
| { | |
| return "test-base.twig"; | |
| } | |
| protected function doDisplay(array $context, array $blocks = array()) | |
| { | |
| $this->parent->display($context, array_merge($this->blocks, $blocks)); | |
| } | |
| // line 4 | |
| public function block_myname($context, array $blocks = array()) | |
| { | |
| // line 5 | |
| echo "Hello "; | |
| if (isset($context["name"])) { $_name_ = $context["name"]; } else { $_name_ = null; } | |
| echo $_name_; | |
| echo "! | |
| "; | |
| // line 7 | |
| $this->env->loadTemplate("test-include.twig")->display($context); | |
| // line 8 | |
| echo " | |
| "; | |
| } | |
| // line 11 | |
| public function block_sidebar($context, array $blocks = array()) | |
| { | |
| // line 12 | |
| $this->displayBlock("parent_sidebar", $context, $blocks); | |
| echo " | |
| "; | |
| // line 13 | |
| $this->displayParentBlock("sidebar", $context, $blocks); | |
| echo " | |
| Left | |
| "; | |
| } | |
| public function getTemplateName() | |
| { | |
| return "test.twig"; | |
| } | |
| public function isTraitable() | |
| { | |
| return false; | |
| } | |
| public function getDebugInfo() | |
| { | |
| return array ( 65 => 13, 61 => 12, 58 => 11, 53 => 8, 51 => 7, 44 => 5, 41 => 4, 12 => 2,); | |
| } | |
| } | |
| <?php | |
| /* test-base.twig */ | |
| class __TwigTemplate_f289ef8d15e75cf17c547bea3a349597 extends Twig_Template | |
| { | |
| public function __construct(Twig_Environment $env) | |
| { | |
| parent::__construct($env); | |
| $this->parent = false; | |
| $this->blocks = array( | |
| 'sidebar' => array($this, 'block_sidebar'), | |
| 'myname' => array($this, 'block_myname'), | |
| ); | |
| } | |
| protected function doDisplay(array $context, array $blocks = array()) | |
| { | |
| // line 1 | |
| echo "<side> | |
| "; | |
| // line 2 | |
| $this->displayBlock('sidebar', $context, $blocks); | |
| // line 3 | |
| echo " | |
| </side> | |
| --- Header --- | |
| "; | |
| // line 7 | |
| $this->displayBlock('myname', $context, $blocks); | |
| // line 10 | |
| echo " | |
| "; | |
| } | |
| // line 2 | |
| public function block_sidebar($context, array $blocks = array()) | |
| { | |
| echo "Sidebar"; | |
| } | |
| // line 7 | |
| public function block_myname($context, array $blocks = array()) | |
| { | |
| // line 8 | |
| echo "Hola "; | |
| if (isset($context["name"])) { $_name_ = $context["name"]; } else { $_name_ = null; } | |
| echo $_name_; | |
| echo "! | |
| "; | |
| } | |
| public function getTemplateName() | |
| { | |
| return "test-base.twig"; | |
| } | |
| public function getDebugInfo() | |
| { | |
| return array ( 46 => 8, 43 => 7, 37 => 2, 32 => 10, 30 => 7, 24 => 3, 22 => 2, 19 => 1, 65 => 13, 61 => 12, 58 => 11, 53 => 8, 51 => 7, 44 => 5, 41 => 4, 12 => 2,); | |
| } | |
| } | |
| <?php | |
| /* blocks.twig */ | |
| class __TwigTemplate_3f50c680c9ed6e9a5f48a1dc01e2bac8 extends Twig_Template | |
| { | |
| public function __construct(Twig_Environment $env) | |
| { | |
| parent::__construct($env); | |
| $this->parent = false; | |
| $this->blocks = array( | |
| 'sidebar' => array($this, 'block_sidebar'), | |
| ); | |
| } | |
| protected function doDisplay(array $context, array $blocks = array()) | |
| { | |
| // line 1 | |
| $this->displayBlock('sidebar', $context, $blocks); | |
| } | |
| public function block_sidebar($context, array $blocks = array()) | |
| { | |
| // line 2 | |
| echo "Right | |
| "; | |
| } | |
| public function getTemplateName() | |
| { | |
| return "blocks.twig"; | |
| } | |
| public function getDebugInfo() | |
| { | |
| return array ( 18 => 1, 46 => 8, 43 => 7, 37 => 2, 32 => 10, 30 => 7, 24 => 2, 22 => 2, 19 => 1, 65 => 13, 61 => 12, 58 => 11, 53 => 8, 51 => 7, 44 => 5, 41 => 4, 12 => 2,); | |
| } | |
| } | |
| <side> | |
| Right | |
| Sidebar | |
| Left | |
| </side> | |
| --- Header --- | |
| Hello Fabian! | |
| <?php | |
| /* test-include.twig */ | |
| class __TwigTemplate_9b368acc6ccc98b6fa1742649f16115a extends Twig_Template | |
| { | |
| public function __construct(Twig_Environment $env) | |
| { | |
| parent::__construct($env); | |
| $this->parent = false; | |
| $this->blocks = array( | |
| ); | |
| } | |
| protected function doDisplay(array $context, array $blocks = array()) | |
| { | |
| // line 1 | |
| echo "--- Nice World --- | |
| Hallo "; | |
| // line 2 | |
| if (isset($context["name"])) { $_name_ = $context["name"]; } else { $_name_ = null; } | |
| echo $_name_; | |
| echo "! | |
| --- End World --- | |
| "; | |
| } | |
| public function getTemplateName() | |
| { | |
| return "test-include.twig"; | |
| } | |
| public function isTraitable() | |
| { | |
| return false; | |
| } | |
| public function getDebugInfo() | |
| { | |
| return array ( 20 => 2, 17 => 1, 18 => 1, 46 => 8, 43 => 7, 37 => 2, 32 => 10, 30 => 7, 24 => 2, 22 => 2, 19 => 1, 65 => 13, 61 => 12, 58 => 11, 53 => 8, 51 => 7, 44 => 5, 41 => 4, 12 => 2,); | |
| } | |
| } | |
| --- Nice World --- | |
| Hallo Fabian! | |
| --- End World --- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment