473,378 Members | 1,422 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

PHP & TPL files

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?

Oct 30 '05 #1
7 23808
Maximus wrote:
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?


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 {$variablename} 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.
Oct 30 '05 #2
Thanks Juliette. It worked.

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

Oct 30 '05 #3
Maximus wrote:
Thanks Juliette. It worked.

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


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
works: http://www.php.net/manual/nl/function.include.php

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.
Oct 30 '05 #4
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.

Oct 30 '05 #5
What is a template parser? I use Savant currently.

Tezza wrote:
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.

Oct 31 '05 #6
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>
<body>
<h1><?php echo $title ?></h1>
<?php echo $content ?>
</body>
</html>

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?

Oct 31 '05 #7
I had a quick look at servant.
http://www.phpsavant.com/yawiki/inde...e=StartExample
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.

Oct 31 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: BoonHead, The Lost Philosopher | last post by:
I think the .NET framework is great! It's nice, clean and logical; in contradiction to the old Microsoft. It only saddens me that the new Microsoft still doesn't under stand there own...
4
by: MLH | last post by:
A programmer developed an AMP (Apache/MySQL/PHP) application for me. When he was done, he sent me the PHP files and the MySQL dump file. Now, when I connect to the application on my LAN using...
4
by: johkar | last post by:
When the output method is set to xml, even though I have CDATA around my JavaScript, the operaters of && and < are converted to XML character entities which causes errors in my JavaScript. I know...
6
by: Abubakar | last post by:
Hi, I'm working on a project in unmanaged c++. I was writing all (most of) my code in header files, that is, no seperation of code in header and cpp files, as usually is done in c++. I feel pretty...
4
by: jamie | last post by:
My data may contain the characters < ,&, and > The system I'm sending them to wants them to be changed to < & and > respectivily. So I had gone into the data and was changing them over in the...
1
by: EoRaptor013 | last post by:
Not sure where to ask this question, but... I'm using a TreeView component to enable browsing file folders in a specific directory (for test purposes /Program Files/). Some users use an ampersand...
14
by: Arne | last post by:
A lot of Firefox users I know, says they have problems with validation where the ampersand sign has to be written as &amp; to be valid. I don't have Firefox my self and don't wont to install it only...
7
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get...
3
by: jake | last post by:
I am new to xml. I have a routine that parses xml files using a regular XmlReader class. Unfortunately, the XmlReader chokes (throws an exception) on character codes such as "&Eacute;". I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.