Jump to content
xisto Community
Sign in to follow this  
reconraiders

Php Templates How they work

Recommended Posts

Can anybody here please explain to me a little bit about PHP template systems. I've seen them in forum systems that I've used before like phpBB and MyBB. I've never really understood how they work exactly. I'd like to make my own sometime too. If you can give me any simple advice or complex, that would be cool. Or just point me to a good tutorial or something maybe? Thanks.

Share this post


Link to post
Share on other sites

I don't believe that in internet there is comprehensive tutorial for that. This is very long topic. But main idea is to separate design and php coding so that designer could edit veiw of site without php knowledge. For example:

<head>		<title>{site_title}</title>	</head>	<META http-equiv="content-type" content="text/html"; charset="{site_charset}">	<META name="Keywords" content="{site_keywords}">	<META name="Description" content="{site_description}">	<META name="Author" content="AztEK (zhkot@bk.ru)">	<LINK href="skins/guest/{guest_skin}/style.css" type="text/css" rel="stylesheet"></head>
This is header part of one guestbook(real). As you see there is no exact value for site charset, title and so on. These words that in {} will be replaced by its set values in server side. If you want to change or add some tags you don't need to know php.
If you want to make proffesional template supporting projects the best way is to buy book and begin to read and try.

Share this post


Link to post
Share on other sites

I understand what they do but I don't understand exactly HOW they work. Does a script just parse all everything on the template page and look for the "{" and "}" and then replace that with some dynamic string?

Share this post


Link to post
Share on other sites

all this sound so counfusing because all i know is html coding. php is so hard to understand. i think someone should try making a forum tutorial on this site to help everyone out.

Share this post


Link to post
Share on other sites

I understand what they do but I don't understand exactly HOW they work. Does a script just parse all everything on the template page and look for the "{" and "}" and then replace that with some dynamic string?

If you use {someting} -style template pages must be parsed and replaced with certain values. It takes time. Best way is simply to use <?=$somevalue ?> -style. In this case server itself will replace variables with its values.Take a look to this article :
http://www.massassi.com/php/articles/template_engines/
Edited by Azeri_boy (see edit history)

Share this post


Link to post
Share on other sites

hi,before u can use php template system, u should have preliminary knowledge on php+html.the simplest and i still use it till now, is fasttemplate. its not developed again, but it's so mature and easy to use. there's no programming at all in template.most modern template system allow u to insert small program there.btw,why we should use template system?a. to separate between html and programming (php) part. so, designer and programming can start work together in the same time.b. make the html easy to maintain. most designer use wysiwyg html editor, in contrast, programmer use text editorc. make the source code cleaner, because all html part reside on the template.that's all i know for now..cheers,

Share this post


Link to post
Share on other sites

using PHP templates for the site helps us to reduce the time spent on designing each pages in our websites, all we've to do is design it once and forget it and the template will be applied to all the other pages by including the necessary files in each page.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.