Post on 08-Aug-2015
transcript
Find me @
- Thijs.dp@gmail.com - twitter #Thijzer- instagram #thijsdp- https://github.com/Thijzer- ICQ # 1079428- https://plus.google.com/108354583103011120629
Twig Integration : Topics
- Twig Magic- Diff : Twig | Spoon- Syntax Filters, Modifiers, Form object, BC- spoon2twig command- Up next
Diff Twig <> Spoon- Twig is slightly faster in compile time- Twig caches better- Dev friendly and widely used syntax (Jinja, Django)- Twig is still being developed- works with existing actions, modules- no changes needed in your files- syntax highlighting in your IDE- Awesome Documentation
Twig uses Moustache variables
-> {$variable}-> {{ variable }}
Spoon Globals have the same name (BC){$LANGUAGE} -> {{ LANGUAGE }}
Twig operators
-> {option:hasValue}{/option:hasValue}-> {% if hasValue %}{% endif %} …
-> {iteration:values}{/iteration:values}-> {% for value in values %}{% endfor %}
Twig uses Spoon Modifiers Filters
All spoon modifiers are accessible
-> {$var|getnavigation:'page':0:1}-> {{ var|getnavigation('page', 0, 1)|raw }}
Twig : Filters
All spoon filters are accessible with some exceptions
-> {$lblEmail|ucfirst} -> {{ lbl.Email|capitalize }}-> |raw for html encoding
spoon2twig converter
- converts all your tpl files into twig files- 99.999% something accurate :)- no positions :/- converts individual files- a forced option if twig file is present- yes it even converts an iteration in iteration- depluralize and shortens your iterations
spoon2twig converter
php tools/spoon2twig.php path -t *-m *-f
php tools/spoon2twig.php -t *-f bootstrap php tools/spoon2twig.php all
* not ready
Up Next :
- We want OBJECTS!!- Twig is Frontend Only (for now)- Spoon2twig commands for specific themes
or modules