Trying to get started. Created my first theme, have this .info file:

name = Tommis Twig Theme
description = My first Twig Theme
screenshot = images/screenshot.png
core = "7.x"
project = "tommis_twig_theme"
base theme = stark
engine = twig

Found out I can make it a Stark subtheme. Great!

Now created a node.tpl.html. Cleared cache and expected the node I created to vanish because overriden by an empty template. Does not happen. Hm. Strange.

Next problem: Normally, I would start with an empty node.tpl.html file and drop in Variables one by one, seeing as it evolves.

But how are the variables named now? I do not have $title, I do not have $content, I have nothing.
Or is it more easy than I think and they are just named {{ title }} and {{ content }} and I just have to figure out the naming conventions?

Comments

eigentor’s picture

O.K. I get it. The theme needs to be compiled into /sites/default/files/twig_cache to be used by drupal.
I installed your d7-twig-distro, and it appears to have some error in the node.tpl.twig file:

You had {% block name=node %} in line 5, but I guess it needs to be simply {% block node %}

But If i put this in, the node is rendered in a strange way, with three comment forms
http://screencast.com/t/R3KgFe7lPGi

Rene Bakx’s picture

the node.tpl.twig was a rush job yesterday, the name indeed was not needed. Why it renders 3 comment form is a mystery to me, but then again I never tried to extend a non twig theme.

The compilation process happens automatically, just name them like you used to, except use .tpl.twig instead of tpl.php Clearing the cache at this moment does not work, because drupal clear_cache hook is not called on engines, only modules.

eigentor’s picture

Is the new distro (well let's say installation as it has a settings.php ;) ) you linked to here renebakx.nl/tfd/d7-twig-distro.zip different from the one I tried out first?

Maybe I should meet you some time in IRC when I am just trying it out. I guess you have me up and running in no time, the conversation in this thread is suffering a delay so that wen I try, I have questions, and when you answer, I have no time to test.

Are you to be found in some IRC channel regulary? Or maybe in Skype?
feel free at info@rufzeichen-online.de if you do not want to post a Skype name here.

autopoietic’s picture

Issue summary: View changes

Many years late, but just found a great blog post about using Twig for Drupal.

http://blog.niko.io/on-using-twig-for-drupal-7-on-myshadow-org/

Rene Bakx’s picture

Status: Active » Closed (works as designed)

I created a small website that documents most of the extra filters, functions etc. I plan to update this website later this summer, if time will let me. Spare time is a scare good the past years ;)

Check out the documentation on http://tfd7.rocks/