Minimalist Template System again
Here's a likely syntax for a very simple templating system.
\{
{{ code here; }}
{function(obj)}
<?php echo function($obj) ?>
{if (obj->boolean) then ('value') else ('value'.obj->var.'string') }
<?php echo ($obj->boolean) ? 'value' : 'value'.$obj->var.'string' ?>
{while obj}
<?php while ($obj->next()) : ?>
{/while obj}
<?php endwhile; ?>
{obj->var}
<?php echo $obj->var; ?>
{obj->func()}
<?php echo $obj->func(); ?>
{->var}
<?php echo $this->var; ?>
Here's an alternate syntax, inspired by Cheetah (a Python HTML templating language).
#function($obj) <?php echo function($obj) ?> #if($obj->boolean ? 'value' : 'value'.$obj->var.'string') <?php echo ($obj->boolean) ? 'value' : 'value'.$obj->var.'string' ?> #while($obj) <?php while ($obj->next()) : ?> #endwhile <?php endwhile; ?> $obj->var <?php echo $obj->var; ?> $obj->func() <?php echo $obj->func(); ?> $var <?php echo $this->var; ?> $$ $ ## #
That's even less syntax to remember. #if and #while are pseudo-functions, and #function is a real function. That is, # preceeds any function. Note the clever (sick) trick for #if.
Also, for convenience, it should be possible to embed while loops in comments: <!--#while($obj)--> and <!--#endwhile-->. This way, you can insert the tags in a wysiwyg editor without breaking the layout. You shouldn't need the comment form for the other items. There is only one control structure in this little language. There's only one conditional, and that always returns some kind of output.
The goal is to edit the HTML templates in an HTML editor. They can be compiled down into simple PHP, and that, in turn, can be include()ed by PHP for fast compilation, cacheing, and whatever else the Zend engine does.

