On Aug 12, 2005, at 4:45 PM, David Nicol wrote:
Just pick a naming convention and run what you get back from the
designers through the substitution operator. I like square brackets
around the variable names, since that convention has some history.
my $output = $TemplateCache{$template_name};
$output =~ s/\[(\w+)\]/$InsertableVariables{$1}/g;
print $output;
If all you want is variable substitution, just do variable
substitution.
I have both of those right now.
BUT I'll be working with a lot of user-submitted data.
I can invalidate / rewrite user data that could mess up my lame
templating/substitution scheme right now.
But then I have to commit to not changing any of my templating schemes
from this point forward.
Let me rephrase: if i'm relying on regex, its possible that someone
will enter in text that one of my regexs match. i can put in
safeguards against that now, but then I pretty much lock myself into
this scheme - something i don't want to do, because this is a quick
hack to get a project up and running, and if things get bigger I would
probably need a more robust/serious solution that my safeguards have
created a nightmare to maintain.
So...
I thought of doing something like an HTML tree, as I could then treat
templates based on nodes in the dom tree...
On Aug 12, 2005, at 4:47 PM, Perrin Harkins wrote:
SSI under mod_perl does everything that Text::TagTemplate does.
I can't begin to explain what I have in place right now - and while I'm
sure SSI in mod_perl would be a good solution to a similar problem,
everything that I've read about it makes it seem wholly incompatible
with the current status of the project. I think I would have to redo
almost the entire project to handle things under SSI, and I would only
have to write about 200lines to integrate Text::TagTempate or
HTML::Tree