Published 2003-10-12 11:23:05

demian from PHPkitchen uses my template engine in his framework (hehe we all have one of those..) anyway - he was upgrading from the original early version to the current CVS one. Which has a tokenizer and is a 2 part parser/compiling system.. (pretty awesome really)

Two of the things problems he found where
a) includes
Includes in the old engine used {include:#xxxx.html#}, I disabled this for numerous reasons in the new engine, but have been tempted into bringing it back. The current thought on it is this:
<flexy:include src="xxx.html" />

of course if you really want to get clever with it you can do things like

<flexy:include src="xxx.html"><B>xxx.html goes here</b></flexy:include>

which will display
xxx.html goes here whey you edit the template in a WYSIWG editor - and disappears when compiled..

b) javascript and scripts.
You can not use flexy tags {varname} in javascript blocks surrounded by <script></script>, as the whole thing gets too messy with it accidentally replacing stuff it shouldnt..
So if you need to send variables to javascript you can use
<flexy:toJavascript flexy:prefix="xxxxx_"
abc="xyz"
bcd="wxy"
/>
this is turned into php code that converts $object->xyz into xxxxx_abc in javascript
eg. in php
$this->xyz = 1234;
$this->wxy = "hello"
$flexy->outputObject($this);

using the above tags - it ends up at the browser as
<script language="javascript">
var abc = 1234;
var bcd="hello";
</script>

Extend me!

Both of these are contained in the HTML_Template_Flexy_Compiler_Standard_Flexy class. The idea of this directory is clever - if you want to create your own namespace tags: eg. <mytag:test xxx="tttt"> all you need to do is create a file in the Standard folder called Mytag.php and implement testToString() method.


Mentioned By:
google.com : HTML_Template_Flexy (106 referals)
google.com : flexy include (104 referals)
google.com : flexy:include (80 referals)
google.com : flexy javascript (55 referals)
google.com : april (49 referals)
google.com : december (46 referals)
google.com : flexy xxx (39 referals)
google.com : HTML_Template_Flexy include (15 referals)
google.com : HTML_Template_Flexy javascript (14 referals)
google.com : xxx flexy (14 referals)
google.com : <flexy:include (8 referals)
google.com : php flexy include (7 referals)
google.com : "flexy:include" (5 referals)
google.com : flexy:include variable (5 referals)
google.com : PHP flexy (5 referals)
google.com : "<flexy:include" (4 referals)
google.com : <flexy:include src (4 referals)
google.com : flexy include php (4 referals)
google.com : flexy include variable (4 referals)
google.com : flexy javascript variables (4 referals)

Comments

Absolutely awesome (Flexy in general, and the namespace tags stuff). It seems to give you most of what JSP/TAGLIB does, but you don't have to run a silly Java Servlet runner. I think it would be good if there were additional configurable extensions directory(s). And perhaps a generic class with the basic functions already in them, that people can extend from. The option to convert the Token_* classes to Flexy_Elements (not very hard I wouldn't think - just a quick recursion?), would also be nice.

If I can get my head around some of it I might submit some patches. :)
#0 - Ryan ( Link) on 2004-02-11 09:15:42 Delete Comment

Add Your Comment

Follow us on