Re: [PHP Template] Revised proposal

[email protected] (Nicolay Mausz)
Newsgroups php.template
Message-ID <[email protected]>
Hi,

We have written a template/layout engine (commercial) in PHP. A small compiler (written in PHP) called "layout-converter"  picks up the template/layout and converts it to a PHP script (with many eval,
include and other commands). Our goal was to make it as easy as possible for a web designer. 

I made a short look at your proposal - but I do not know FastTemplate.

Maybe some points might be useful:

* $ <-> { }
We are using $command or $variable . The only advantage I see is in TeX files (which can be converted too with our compiler), because in TeX you have got many { } brackets, so there is no conflict.
Maybe it it might be possible to set this special character(s) with a configuration function. But I think TeX will not be used very often :-)

* Included files: This is one of the most difficult parts. You might want to convert every relative URL (e.g in href, img src) into absolute ones but only  absolute paths are not very flexible, if you
are working with pre-compiled templates.
Our solution : 
Instead of <img src="pics/pic.gif"> => <img src="/mypath/pics/pic.gif>
this will be converted into
<img src="pics/pic.gif"> => <img src="<? echo BASEPATH ?>pics/pic.gif>
where BASEPATH is a constant which will be defined earlier in a seperate file (the alias-list). So we are calling it path alias. Every template might have its own path alias. Btw.: we have got a
special path alias feature - with @aliasname/something you can call that path/alias in a template.
There are other problems we encounter with dynamic included templates - which might be too specific to our system...

Some other commands in our converter:
* Defining of layout-objects which can be called at any time later - simillary to "section" I think:
You can use use (HTML-)files as object libraries. Only everything between $object name{ .... $} will be parsed, everything outside will be ignored.

* We have got many commands for looping, output of trees,...
E.g. $loop{ ... $} - loops through everything in the current context.
$depthloop{ ... $} loops the current depth in the tree
$listloop{ ... $} loops through an array.
and much more

I do not completely understand your looping concept. Maybe you have an example ?

Nicolay Mausz

flying dog software
www.flyingdog.de
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.