Re: RFC: xipe enhancement
| From: | Sam Liddicott | Date: | Thu, 10 Jul 2003 10:04:09 +0000 |
| Subject: | Re: RFC: xipe enhancement | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18124@lists.php.net to get a copy of this message | ||
"Alan Knowles" <alan@akbkhome.com> wrote in message
news:3F0CC2BB.2030205@akbkhome.com...
> Sam Liddicott wrote:
> > I'm requesting comment on a new templating enhancement I thought of and
am
> > working on, which I wish to contribute to XIPE.
>
> Interesting idea.. - you know that you could add this in about 10 lines
> of code to Flexy? - just modify the toHtml part of
> HTML_Template_Flexy_Token_Tag to check for the method attribute.. and
> store the methods in a static global... then output later..
With all my searching I am surprised I didn't check flexy as it seems to be
a progression from xipe that interests me.
> For the method variable intopolation to work.. ,you would probably have
> to parse and add the variables from the method call to the available
> variables in the engine (theres and example in the foreach token from
> what I remember)
Yes, and I wanted to build on what someone was doing in that regard. In
adding class-making to templtes I dont wnt to ignore or duplicate other good
stuff.
> yes - normally using namespaces for custom attributes is a good idea -
> most of flexy's custom attributes / foreach.. etc. use flexy:foreach
> prefixes.
I would like to build this into flexy, although it seems we have different
aims; you to allow embedding of php structures into html and me to remove
that need, which choice the user takes depends on the user, both are
compatable,
> I did think about something like this for 'blocks' and defining
> funcitons or something. but ran into problems deciding on naming
> conventions. What strategy did you have for naming the classes, as if
> you have a fixed name, you cant load two pages into the same request.
> and md5'd class names means extending/overriding them is difficult..
The actual class name is specified in the driving php which I didn't show
you; it overrides any base class given in the template. Because classes,
not functions, are defined from the template everything the template defines
has its own namespace.
Driving php:
include("mt/mt.php");
class rawpage {
function showTitle() {
echo "<h2>My TITLE secret</h2>";
}
function navs() {
foreach(array("a"=>"1","b"=>"2") as $k=>$v) {
$this->nav($a,$b);
}
}
}
# extend rawpage, define basepage from template
$te=new mt("basepage","rawpage");
$outputfile=$te->parsetemplate("sample.html");
# the way this is done will make use of someone elses caching engine and
such
include($outputfile);
$page=new basepage();
$page->document();