Welcome to Template Engine Demo

Here you can learn about how to do the view part in MVC with DooPHP using its template engine.

IF statement is SUPPORTED now. You can use partial caching mechanism with the tempalte engine too!

View the template source (html).

Test drive Template Engine



View test, variable, tags, loop, loop assoc array, double loop:

Username: {{username}}
Username upper case: {{upper(username)}}

Hi admin! Please administer.

Hi {{username}}! welcome back.


Using a function in template_tags.php to print_r. You control what you want to be available in the template. {{DeBuG(messages)}}


Messages list:

Just a simple loop

  1. {{messages' value}}

User name list:

Functions can be used in loop

  1. {{upper(user' key)}} : {{upper(user' value)}}

Full name for user john:

{{user.john}}

Full name for user john UPPER case:

{{upper(user.john)}}

Total user:

Associative array usage

Male = {{tofloat(member.total.male)}}
Female = {{member.total.female}}
Female = {{sample_with_args(member.total.female, 'we female')}}
Female = {{TRIPLE(member.total.female, ' x3 female + ', 1000)}}

Kids Male = {{member.totalKids.male}}
Kids Female = {{member.totalKids.female}}

Teen Male = {{member.totalTeen.male}}
Teen Female = {{member.totalTeen.female}}

User's messages list:

Nested loop example


Messages with detail:

Nested loop with Assoc array example

  1. {{upper(msgdetails' value.subject)}} ATTACH: {{msgdetails' value.attachment.pdf}}

The Winner is:

Using objects

Winner name: {{winner.@fullname}}
Gender: {{winner.@gender}}

Winner's Physical Profile:
Weight: {{winner.@Physical.@weight}}
Height: {{winner.@Physical.@height}}

Winners list:

Using objects in loop

winners' value, loop' value, loop' v, l' v, somename' v are the same


Loop Blog post with tags

{{posts' value.@title}}
{{posts' value.@content}}
{{posts' value' value.@name}},

BACK TO TOP