Re: [PHP Template] Revised proposal

[email protected] (Dan Libby)
Newsgroups php.template
Message-ID <[email protected]>
1) I still like "{{" better than "{" so people won't have to escape single
curlies.

2) I think there are issues with include.  Suppose that:

designer creates template a.
developer writes code to load and fill in vars for template a.
designer (or someone) later includes template b from template a.  template
b has variables not filled in by code.  This is broken.   I suppose the
same is true if designer goes back and adds a random new var to template
a, but it just seems problematic to me.

Another thing is the issue of how to specify the include files.  Is the
path relative or absolute? Should absolute paths be allowed? If relative,
is it relative to the current template or to the current request?  I would
tend to say that it should be relative to the parent template, or if
absolute, then that is relative to doc_root, not file system root.

3) The if statements all assume scalar values for variables.  I assume
this would work in a looping construct -- it would simply operate on the
index currently be processed.

4) still not convinced of need for config vals.  Why couldn't PHP code
load any needed values and fill them into the regular vars?

5) I think that tpl_hide (clear) is a useful API.

6) There should probably be a tpl_addval() API for adding a new value to a
non-scalar variable.  useful for looping when you need to rearrange an
array, eg:

$people = array(array("dan", "libby"), array("andrei", zmievski))
while(list($key, $val) = each($people)) {
  tpl_addval("fnames", $val[0]);
  tpl_addval("lnames", $val[1]);
}

7) I think that tpl_getvars() is useful so you can determine if a
particular value has been set or not.


-dan

Andrei Zmievski wrote:

> I've revised the PHP Template Engine proposal according to some of the
> discussion that went on yesterday. Please look through it again, and
> let everyone know your thoughts.
>
> http://va.php.net/~andrei/tpl-engine.txt
>
> -Andrei
> * Entropy isn't what it used to be. *
danda.vcf (text/x-vcard, 304 B)
begin:vcard 
n:Libby;Dan
tel;work:650-210-2356
x-mozilla-html:TRUE
url:http://www.epinions.com
org:Epinions.com;Engineering
adr:;;;;;;
version:2.1
email;internet:[email protected]
title:Morlock
note:We're hiring at epinions.com.  Engineers, site designers, QA -- we need you.
fn:Dan Libby
end:vcard
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.