Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Templates, How they work
Rating 5 V
reconraiders
post Jun 8 2007, 06:55 PM
Post #1


Super Member
*********

Group: Members
Posts: 221
Joined: 6-June 07
Member No.: 44,288



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.
Go to the top of the page
 
+Quote Post
Azeri_boy
post Jun 8 2007, 09:54 PM
Post #2


Newbie [Level 1]
*

Group: Members
Posts: 23
Joined: 10-April 07
From: Azerbaijan
Member No.: 41,391



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:
CODE
<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.
Go to the top of the page
 
+Quote Post
reconraiders
post Jun 8 2007, 10:16 PM
Post #3


Super Member
*********

Group: Members
Posts: 221
Joined: 6-June 07
Member No.: 44,288



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?
Go to the top of the page
 
+Quote Post
arza1
post Jun 9 2007, 03:11 AM
Post #4


Premium Member
********

Group: Members
Posts: 194
Joined: 3-June 07
From: Franklin, IN
Member No.: 44,126



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.
Go to the top of the page
 
+Quote Post
Azeri_boy
post Jun 9 2007, 10:26 AM
Post #5


Newbie [Level 1]
*

Group: Members
Posts: 23
Joined: 10-April 07
From: Azerbaijan
Member No.: 41,391



QUOTE
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/

This post has been edited by Azeri_boy: Jun 9 2007, 10:34 AM
Go to the top of the page
 
+Quote Post
reconraiders
post Jun 13 2007, 05:02 PM
Post #6


Super Member
*********

Group: Members
Posts: 221
Joined: 6-June 07
Member No.: 44,288



I found a little tutorial on templates. It's not too bad. I think I will base mine on it, but develop it further. The script in the tutorial is relatively simple and kinda inefficient. But it's a good start for what I was looking for.

Here's the link
http://www.phpfreaks.com/tutorials/70/0.php
Go to the top of the page
 
+Quote Post
randompage
post Jun 15 2007, 07:27 PM
Post #7


Newbie
*

Group: Members
Posts: 5
Joined: 15-June 07
Member No.: 44,839



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 editor
c. make the source code cleaner, because all html part reside on the template.

that's all i know for now..

cheers,
Go to the top of the page
 
+Quote Post
Blessed
post Jun 16 2007, 09:33 PM
Post #8


Advanced Member
*******

Group: Members
Posts: 144
Joined: 22-March 07
Member No.: 40,472



Greeting

nice links man,
thanx for the links,
this really helps me allot.

have a nice day.
God Bless you guy's
Go to the top of the page
 
+Quote Post
delivi
post Aug 20 2007, 05:40 PM
Post #9


Trap Grand Marshal Member
***********

Group: [HOSTED]
Posts: 1,308
Joined: 11-January 06
From: Chennai, India
Member No.: 16,932



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.
Go to the top of the page
 
+Quote Post