Vivvo Template Engine (VTE)

If you want to skip introduction, just Get Started with VTE!

What's behind Vivvo?

Vivvo Template Engine was developed as a template engine for Vivvo CMS. Our main goal in design and development was to create a template engine that would be light-weight and easy to use, yet powerful and scalable. And of course high-performance, which is a must. The template engine that can do recursions, object calls, arrays, but still remain within a single class in less than 1000 lines of code! The main problem with many robust template engines (like Smarty) is that most developers use barely 20% of their power and that's exactly why our goal was quite the opposite - a template engine that most web applications will drive at 90% of its speed with a minimal learning curve.

Introduction to VTE

What if we...

Normally we would prepare the content for you in PHP and let you model it trough templates. That would mean that we have to prepare everything you might want to publish, disregarding what is in your templates.

But what if we turned the tables, what if your template told us what block of code to load, what SQL query to make, what RSS to fetch, etc. Well, that is what VTE does for you.

The Engine

VTE denotes two things: key component of Vivvo framework and Vivvo Template Engine (XML) language namespace. One might treat VTE language (in futher text VTEl) as simplified procedural language introduced to achieve complete separation of presentation layer and business logic. VTEl should be your major tool in customizing your Vivvo feel and functionality (for look please use CSS). VTE uses context scope chain, meaning that when searching for variable value VTE starts from current leaf and goes down to the root. For module loading VTE relies on Vivvo configuration table, so every module must be registered before it can be used.

VTE language

VTE language is XML-based and it consists of tags and attributes (more about individual tags can be found here). It uses VTE namespace and can be mixed with any other XML language (ie. xHTML). Each VTE template must be a valid XML document.

Each VTE template must be well formated XML document, and it must not contain XML heading and doctype (issue with expat on some PHP versions)

A VTE primer:

<h1><vte:value select="{article.get_title}" /></h1>
<div class="article_metadata">
	<vte:if test="{VIVVO_ARTICLE_SHOW_DATE}">
		<span class="metadata_time"><vte:value select="{article.get_created}" /></span>
	<vte:if test="{VIVVO_ARTICLE_SHOW_AUTHOR}">
			<a href="{article.get_author_href}"><vte:value select="{article.get_author_name}" /></a>
				<vte:value select="{article.get_author_name}" />

Getting Started

VTE is easy to grasp with quick learning curve. If you're familiar with any template engine at all, like Smarty or similar you'll get into this in no time. So, Get Started with VTE!


Vivvo Template Engine was first constucted as a light-weight template class written in PHP and completely PREG based.

This version of VTE was released under GPL 2.0 and can be found on Google Source Code.

devdoc/vte.txt · Last modified: 2008/11/08 10:43 by boccio
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki