|
|
Invisible wrote:
>> Don't do that on a real project. Use actual data-like templates. The
>> problem is that the person writing the code isn't the person who
>> decides what goes in the HTML.
>
> Hmm. That sounds like an interesting problem to attempt to solve...
Meh. I use a templating thing. I have a call to which you pass a
template name, a style, an array of name->value pairs, and an array of
name->function mappings.
The template name and style maps (eventually) to a file, with stuff like
<p>Welcome, <{name}>!</p>
<p><red><{{errormessage}}>></red></p>
Lines with <{{stuff}}> where there's no "stuff" key in the name->value
array disappear completely. The rest get substituted. If the name has a
"*" on the end, it doesn't get HTML-escaped, so you can pass raw HTML
from the code. The name->function lets you do things like "display
values greater than five minutes in red" or "NULL turns into 'N/A'"
On top of that, I built one that takes a head, row, and foot template,
as well as a record resource (as returned by mysql_query()) and
generates the whole page.
--
Darren New / San Diego, CA, USA (PST)
On what day did God create the body thetans?
Post a reply to this message
|
|