Skip to content

Instantly share code, notes, and snippets.

@mikemadisonweb
Last active April 18, 2016 11:21
Show Gist options
  • Save mikemadisonweb/3b6e65bcbbf5f01365bb to your computer and use it in GitHub Desktop.
Save mikemadisonweb/3b6e65bcbbf5f01365bb to your computer and use it in GitHub Desktop.
Twig
{{ 'now'|date("Y") }}
For $_POST variables use this :
{{ app.request.parameter.get("page") }}
For $_GET variables use this :
{{ app.request.query.get("page") }}
For $_COOKIE variables use this :
{{ app.request.cookies.get("page") }}
For $_SESSION variables use this :
{{ app.request.session.get("page") }}
{% import _self as macros %}
{% block content %}
<ul class="mt-doc-list">
{% for rubric in rubrics %}
{{ macros.recursiveRubrics(rubric) }}
{% endfor %}
</ul>
{% endblock content %}
{% macro recursiveRubrics(rubric) %}
<li>
<a href="{{ rubric.path }}">{{ rubric.title }}</a>
{% if rubric.children|length %}
<ul>
{% for child in rubric.children %}
{{ _self.recursiveRubrics(child) }}
{% endfor %}
</ul>
{% endif %}
</li>
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment