Templates - how and why in php?

PHP coding talk.

Moderator: Moderators

Templates - how and why in php?

Postby Jeane Paul on Tue Jan 02, 2007 11:20 am

Still studying PHP, and yes, am on basics. but, i want to move, like i want to build my site right away.

i have learned already some few stuffs in php, and am really amazed on what it can do; from simple echo to creating a simple weblog(php & sql). now, i know phpBB is using template files for the output, if am not wrong. and, it is really bugging me on how is that.

but what if i want to create a page from php(not in phpBB) and using a template file? how do i that?.

really, pls show me some light about in php on how and why templates. and if there is any tutorial or something i could read on about this subject, pls redirect me to that. am eager in learning php, as i find it really helpful and very good to use in my webpage.

thanks in advance guys.
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby eviL3 on Tue Jan 02, 2007 11:34 am

Hello,

Well many people say it's good to have the code and the display (style) separated. So that's why template systems exist. phpBB's would be includes/template.php. There are many differen't template sytems out there. A really good one is smarty: http://smarty.php.net.

What phpBB does is assign "Template variables", that get inserted into the template, making it dynamic. And you also have switches / loops, for example in viewtopic_body.tpl it's "postrow".
User avatar
eviL3
Registered User
Registered User
 
Posts: 155
Joined: Thu Feb 02, 2006 6:59 pm

Postby Jeane Paul on Tue Jan 02, 2007 11:54 am

uhhm, do i have to install something from that site? but, am reading some crash courses from it; thanks for that!. anything else that you can suggest me? :-s
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines

Postby Jeane Paul on Tue Jan 02, 2007 3:36 pm

so, template engine does separate html & php. X_X another long way to go i think. anyway, i can do it. will post again here, if i have another question.. thanks again!
I'M WONDERING IF, MAYBE, THERE REALLY IS SOMETHING WRONG WITH ME." "EVERY ONCE IN AWHILE, THEY SAY THINGS THAT SOUND LIKE WORDS. THEY MAKE ME THINK ABOUT WHAT I'M DOING.

THE NOISES MAKE ME UNCOMFORTABLE."

================================
[Simple Forum]
User avatar
Jeane Paul
Registered User
Registered User
 
Posts: 363
Joined: Thu Feb 10, 2005 12:27 pm
Location: Manila, Phillipines


Return to PHP Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron