PHP & TPL files

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
a simple questions.

how can I echo a variable made on in a PHP file inside a tpl file.
the TPL file is included inside the PHP file.

any suggestions?

Re: PHP & TPL files

Maximus wrote:
Quoted text here. Click to load it

Are you using a template parser ?
If so, look in the documentation of the parser.

If not, include the template only after you have created your variables  
and by having in the tpl file where you want the  
variable to be placed it will automatically be replaced.

Even so, it all really depends on your set up, i.e. how the tpl file is  
used and interpreted, so the suggested solution may not work.
If it doesn't give us some code so we can make educated suggestions.

Re: PHP & TPL files

Thanks Juliette. It worked.

If there's any link can give me that provides info about TPL files i'd
be thankful.

Re: PHP & TPL files

Maximus wrote:
Quoted text here. Click to load it

Hi Maximus,

If my suggestion worked, you don't need to read up on template files,  
you need to read up on the include statement and understand how that  

If you really want to works with proper templating, you may want to look  
at some open source template parsers.
There are numerous ones available, I won't recommend any as which one  
would be best, depends on your requirements.

Grz, J.

Re: PHP & TPL files

I really recomend the PHP templating parser. I've heard it is really
powerful. And from what I can tell in my experience, it is really easy
to use.

Re: PHP & TPL files

What is a template parser?  I use Savant currently.

Tezza wrote:
Quoted text here. Click to load it

Re: PHP & TPL files

In this context, I suppose you could describe a template parser as a
program which "processes" or "interpertes" template files.

An example of a template is

<?php include "BusinessLogic.php"; ?>
<html><head><title><?php echo $title ?></title></head>
<h1><?php echo $title ?></h1>
<?php echo $content ?>

and php is the program that can interperate this template. Note, your
graphic designer can also load this template up in a product like
dreamweaver and work with the design.

Neat huh?

Re: PHP & TPL files

I had a quick look at servant.
It actually does use PHP for it's templates - which is good.
I would say it is more of an application framework for controlling
separation of concerns (SOC) and things like error management etc. So I
quite like it. It's better than nothing, and will save you making your
own application framework.  

However, I wouldn't use it myself.

Site Timeline