kolber / stacey

Cheap & easy content management
http://staceyapp.com
MIT License
1.04k stars 132 forks source link

Twig Horizontal Reuse #110

Closed pbatts closed 10 years ago

pbatts commented 10 years ago

I'm not sure if this is a bug or I'm not doing something correctly. I can't get Twig's horizontal reuse to work. I am expecting the words "content here" to appear on the web page. Anyone using Twig's "use" tag? http://twig.sensiolabs.org/doc/tags/use.html

This is what I have. Template, test.html


{% extends "default.html" %}
{% use "blocks.html" %}

{% block test %}{% endblock %}

Template, blocks.html


{% block test %} content here{% endblock %}

Thanks,

PB

mjau-mjau commented 10 years ago

I am guessing this is because the feature is not available in the TWIG version integrated with Stacey. I upgraded TWIG in Stacey to latest version, because I needed some of the newer filters. You can upgrade TWIG, but there are some issue to get it to work, read this thread #72 ...

pbatts commented 10 years ago

Thanks @suncat100, that was my first thought also but I found the parser here: app > parsers > Twig > TokenParser > Use.php

The php stuff is over my head so I'm stuck.

Regarding this issue, I'll add that, nothing breaks. But nothing renders.

Thanks, PB

kolber commented 10 years ago

Hey @pbatts, I'm not sure you need to be using use here. use is actually a pretty complicated templating concept. What it actually does is inherit the {% block %}s from another template, but not the content of the blocks themselves.

I'm pretty sure you should be able to get what you're looking to achieve by taking a different approach.

pbatts commented 10 years ago

Thanks, @kolber. I'll look for an alternative.

PB