Skip to content
Q edited this page Dec 13, 2020 · 40 revisions

Willow ~ A logic-less template engine built for WordPress.

Willow has been designed to meet the needs of both front-end and back-end developers by providing a small, yet powerful set of tags and tools to speed up template development and prototype iteration, and is influenced by other template engines, most notably Mustache.

Key Features:

  • Small tag library is easy to learn, use and control
  • Logic-less templates ensure a clean separation of concerns, all logic lives in controllers
  • Limited access to PHP functions and variables provides better UI development experience
  • Portable and re-usable features via template, array and file configuration
  • Built-in support for WordPress, * Advanced Custom Fields, extensible and plays nicely with other themes and plugins

Written in PHP with WordPress as a dependency

Currently this project is developed in the format of a WordPress plugin and has WordPress as a dependency ( using several top-level WordPress functions ), but can eventually be ported to a stand-alone system once more stable and given sufficient demand.

To use willow templates in your project, you will need to install this plugin, then create a template file with a .willow extension - for example test.willow - and select this template via the WordPress editor.

The pages of the wiki will attempt to demonstrate some common use-cases of Willow as well as documenting its syntaxes and internal workings.

Hello Willow

All Willow tags include a matching opening and closing pair, starting and ending with a curly bracket and one other internal character, as follows:

{~ ui~hello {+ Willow says {{ hello }} +} ~}

This tag call tries to find the ui ( context ) hello ( task ) method ( ui->hello() ) and wrap the return data in simple html:

class ui {

	function hello( $args = null ) {

		// define key + value to render ##
		return [
			'hello' => 'Hello'
		];

	}

}

Return:

<div>Willow says Hello</div>

Read more about Willow Tags

Clone this wiki locally