473,811 Members | 1,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 23824
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 "interperte s" template files.

An example of a template is

<?php include "BusinessLogic. php"; ?>
<html><head><ti tle><?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
3661
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 rules when it comes to file paths. A lot of Microsoft installers for example, and also installers of other companies, do not work because they handle paths in the following manner:
4
2819
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 http://192.168.1.106/~mlh/credifree/index.php the AMP app still thinks the data resides somewhere else. It runs fine - as long as I leave my LAN's external internet connection up. But if I unplug my LAN from the world, my app locks up. Before I...
4
3231
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 that I could externalize my JavaScript, but that will not be practical throughout this application. Is there any way to get around this issue? Xalan processor. Stripped down stylesheet below along with XHTML output. <?xml version='1.0'?>...
6
1482
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 comfortable doing this as it my first time writing code in c++. My background is in C#. Now one senior guy ( a non-developer ), came up and wanted to see my code, and he said what I was doing is wrong. What I should do is declare all my code...
4
1328
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 code. However when they hit the serializer I end up with &amp;#60; &amp;#38; and &amp;#62; How can I prevent the serializer from changing this incorrectly?
1
2940
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 ("&") in both folder and file names. This has caused me some real grief! I'm not in a position to tell the users it's an ID 10 T error and they have to change their file and folder names. In VS2K5, I have debugged my code and found that ...
14
5943
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 because of this, so I hope some of you gurus can enlighten me with this :) In what circumstances can the "&amp;" in the source code be involuntary changed to "&" by a browser when or other software, when editing and uploading the file to the web...
7
4634
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 BeautifulSoup to clean those up? There are various parsing options related to "&" handling, but none of them seem to do quite the right thing. If I write the BeautifulSoup parse tree back out with "prettify", the loose "&" is still in there. So...
3
8011
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 resorted to streaming the file first and replacing all the character codes with their corresponding characters (copying the file while replacing character codes at the same time) just to get things going. In the case of &Eacute; I replaced it with...
0
9728
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10135
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7670
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6890
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5554
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3867
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3018
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.