Implement template system with inheritance

RESOLVED FIXED

Status

www.mozilla.org
General
--
enhancement
RESOLVED FIXED
8 years ago
6 years ago

People

(Reporter: abuchanan, Assigned: abuchanan)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [betterness])

(Assignee)

Description

8 years ago
http://www.twig-project.org/

I'll implement some code to allow Twig templates to be used along side our current PHP templates.
(Assignee)

Comment 1

8 years ago
Ok, added Twig library and changed prefetch to allow both Twig and PHP templates to coexist.

In order to do this, we need to follow this convention:  

each Twig template must have this line at the top
{# <?php $is_twig = true; ?> #}


This is what allows prefetch to know what is a Twig template, and what is PHP.  When we're not using PHP templates anymore, we can stop this convention.

Here's an example,
https://www-trunk.stage.mozilla.com/en-US/twig.html


I'll work on adding a base template and some useful extensions to Twig, so we can do things like,

{% download_button %}
{{ url('firefox/all') }}
{{ img('firefox/whatever.png') }}
{{ style('tignish/foo.css') }}
etc
(Assignee)

Comment 2

8 years ago
After pondering this for a long time, Twig might not be the best option, because it's such a big syntax change.  

http://phpti.com/
^ has most of the same features, most importantly inheritance, and uses the same PHP syntax we're already using.  Could be a better option.

I'm going to remove any Twig code I implemented.
Severity: normal → enhancement
Summary: Implement Twig → Implement template system with inheritance
Whiteboard: [betterness]
Component: www.mozilla.org/firefox → www.mozilla.org
Product: Websites → Websites
Component: www.mozilla.org → General
Product: Websites → www.mozilla.org
we have that with jinja/bedrock now
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.