Just wondering - variables in html templates

S

Seansan

Hi,

A lot of programs/scripts use templates with different variable
strings/identifiers that are replaced by calculated values from the program.
In my perl scripts I use @@VAR1@@ and s///i to search and replace these
vars. (example= $tmp =~ s/\@\@STARTURL\@\@/$STARTURL/g; tmp holds the
template). I found that PHP even has some kind of standard (much like
@@VAR@@).

- Is there a module/library that one has heard of on this topic?
- Does a standard exist for perl?
- Simple search and replace is one thing, but what about select lists, or
whole tables (rows). The goal is to have as little formatting in the perl
code as possible!!

As I said, just wondering if there is a better way to do this ...


Grtzz, Seansan
 
S

Sherm Pendley

Seansan said:
A lot of programs/scripts use templates ....
- Is there a module/library that one has heard of on this topic?

There are dozens of them. Is there a reason you didn't go to <http:/
search.cpan.org> and search for "template" before asking this?

sherm--
 
S

Seansan

I'm just asking for best practice .... As you said "There are dozens of
them". Furthermore my preference is a standard/bp instead of a whole module
to load for a simple opportunity.

Seansan
 
S

Sherm Pendley

Seansan wrote:

Backwards. Please don't do that. Replies belong below the text you're
replying to, not above it. Have you read the posting guidelines that appear
here twice a week?
I'm just asking for best practice

No you didn't. You asked if there were any.

Best practice is to have a look at the various modules that are available,
and decide for yourself what one is best for *you*. Opinions and coding
styles vary - that's why there are so many templating modules to begin
with.
Furthermore my preference is a standard/bp instead of a whole
module to load for a simple opportunity.

Using a module *is* the standard for Perl programming. Even if you wind up
writing your own solution, you'll still put it in a module so your scripts
can all use it.
There was a time one could 'just' ask a question in a newsgroup

Spare me. If you'd put *any* effort into doing the most basic searching for
yourself, I wouldn't have snapped at you. You got yelled at for being lazy,
not for "just" asking a question.

sherm--
 
S

Seansan

Sherm start a hobby


Sherm Pendley said:
Seansan wrote:

Backwards. Please don't do that. Replies belong below the text you're
replying to, not above it. Have you read the posting guidelines that
appear
here twice a week?


No you didn't. You asked if there were any.

Best practice is to have a look at the various modules that are available,
and decide for yourself what one is best for *you*. Opinions and coding
styles vary - that's why there are so many templating modules to begin
with.


Using a module *is* the standard for Perl programming. Even if you wind up
writing your own solution, you'll still put it in a module so your scripts
can all use it.


Spare me. If you'd put *any* effort into doing the most basic searching
for
yourself, I wouldn't have snapped at you. You got yelled at for being
lazy,
not for "just" asking a question.

sherm--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top