views:

50

answers:

1

Post a snippet of code from your favorite templating engine, with the name of the engine and a link to its homepage; show off its basic syntax and maybe some neat features about it that makes it unique.

Hopefully this will give people an idea of what's out there and make it easier for them to decide on an engine.

+1  A: 

To get the ball rolling, here's a snippet from Smarty. I've never used it before, so this is just ripped from their documentation; feel free to edit this post if you have a better sample.

Smarty (PHP)

{* I am a Smarty comment, I don't exist in the compiled output  *}
<html>
<head>
<title>{$title}</title>
</head>
<body>

{* another single line smarty comment  *}
<!-- HTML comment that is sent to the browser -->

{* this multiline smarty
   comment is
   not sent to browser
*}

{*********************************************************
Multi line comment block with credits block
  @ author:         [email protected]
  @ maintainer:     [email protected]
  @ para:           var that sets block style
  @ css:            the style output
**********************************************************}

{* The header file with the main logo and stuff  *}
{include file='header.tpl'}


{* Dev note:  the $includeFile var is assigned in foo.php script  *}
<!-- Displays main content block -->
{include file=$includeFile}

{* this <select> block is redundant *}
{*
<select name="company">
  {html_options options=$vals selected=$selected_id}
</select>
*}

<!-- Show header from affiliate is disabled -->
{* $affiliate|upper *}

{* you cannot nest comments *}
{*
<select name="company">
  {* <option value="0">-- none -- </option> *}
  {html_options options=$vals selected=$selected_id}
</select>
*}


{* cvs tag for a template, below the 36 SHOULD be an american currency
. however its converted in cvs.. *}
{* &#36;Id: Exp &#36; *}
{* $Id: *}
</body>
</html>
Mark