• Home
  • Download
  • Manual
    • Installation
    • Static Site
    • patTemplate
    • patForms
    • Users
    • Content Modules
    • Class Overriding
    • AJAX and JavaScript
      • Class loader
    • Tunning Features
    • REST Service
    • Framework
      • Directory Layout
      • Class Loader
    • 3rd party libraries
  • About
    • Ohloh
    • Imprint
    • License
    • Related Blogs
  • Developer
    • To Do
    • Changelog
    • Source
    • Demo Site

TemplateEngine

Wombat uses patTemplate (version 3) as template engine to generate HTML output. patTemplate is free and easy to use template engine. There is a bunch of examples at http://examples.php-tools.net that show both how to write template files and use them from PHP-side.

Site & Composite Template

Main template file template/site.tmpl
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <title>Example</title>
    </head>
    <body>
        <div>
            <h1>Logo Area</h1>
        </div>
        <div style="float:right;with:300px;">
            Sitemap:
            <ul>
                <li>Home</li>
                <li>About
                    <ul>
                        <li>Boss</li>
                        <li>Employees</li>
                        <li>Branches</li>
                    </ul>
                </li>
                <li>Products
                    <ul>
                        <li>Things</li>
                        <li>Stuff</li>
                    </ul>
                </li>
            </ul>
        </div>
        <div style="margin-right:303px;">
            (CONTENT)
        </div>
    </body>
</html>
Renderer's template file template/Composite/main.tmpl
<patTemplate:tmpl name="snippet"> (MAIN)
</patTemplate:tmpl>

There is one major template file for each site. Which file to use can be configured with the skin/tmpl-tag in site.xml. Usually named "site.tmpl" and locate in BASEDIR/template/site.tmpl

Template Modifier

One big feature of patTemplate are template variable modifiers. patTemplate comes with a bunch of generic modifiers (see ) that makes it very easy to format unix-timestamp human readable etc. Besides Wombat brings additional modifiers, those are general purpose modfiers as well, still, they only make sense in a Wombat-Environment.

  • The Clicktext modifier makes plain text clickable. It seeks for anything that looks like an URL and turns it to links. Also it adds HTML-brakes <:br /> for each newline.
  • Wxml This modifier transforms Wombat's internal content-XML format to proper HTML. Use this modifier wherever you display content created with rich text editor.
  • Vfsfile Helps you creating URLs, image-tags or embedded content out of VFSFile-ids.
  • Data implements a very simple access method to fields stored in database. E.g. this modifier can resolve user's id to user's nickname.