php with templates
Posted: Tue Apr 22, 2003 9:14 am
hi guys
i came across with some probelms when i was doing the assignment.
okay here is the problem!
i have created templates. but i cant figureout whether we need templates to all the pages.
i have created a templates for leftnavigation and the header
the thing is u add these leftnavigation and header templates for each page. but how do u do the design of each page. say if u have a seperate page for search! do we put the design part of the search page in a templet and then call it as the content or do we just leave it as an html page. if u r unclear what i'm trying to say. please take a look at this:
structure that i am talking about:.
if i wanna do the search page
i have
1) leftnavigation.tpl
2)header.tpl
3)searchbody.tpl
4)search.php
searchbody.tpl contains the design part of the body.
and search.php will be looking like this:
<?php
include './template.inc';
$tpl = new Template('.');
$tpl->set_file(array('std' => 'std.tpl',
'header' =>'header.tpl',
'leftnav' =>'leftNavigation.tpl',
'content' =>'searchbody.tpl'));
//$tpl->set_var('title', 'Lets watch Plays');
$tpl->parse('header', 'header');
$tpl->parse('leftnav', 'leftnav');
$tpl->parse('content', 'content');
$tpl->parse('DUMMY', 'std');
$tpl->p('DUMMY');
?>
in hear i have called searchbody.tpl as the content part. what my problem is whether u do it like that or just do the searchbody design in an html page.
is this right? i'm bit confused coz when u r doing the validation using java script (client side scripting) then i will have to do them in the searchbody.tpl file.
if so do we have to do like this for each page.
To tell u the truth i have already design all the pages like this. now i'm bit afraid it's not the way u do it!
please reply me if u can. will be a great help
thanks
saj

i came across with some probelms when i was doing the assignment.
okay here is the problem!
i have created templates. but i cant figureout whether we need templates to all the pages.
i have created a templates for leftnavigation and the header
the thing is u add these leftnavigation and header templates for each page. but how do u do the design of each page. say if u have a seperate page for search! do we put the design part of the search page in a templet and then call it as the content or do we just leave it as an html page. if u r unclear what i'm trying to say. please take a look at this:
structure that i am talking about:.
if i wanna do the search page
i have
1) leftnavigation.tpl
2)header.tpl
3)searchbody.tpl
4)search.php
searchbody.tpl contains the design part of the body.
and search.php will be looking like this:
<?php
include './template.inc';
$tpl = new Template('.');
$tpl->set_file(array('std' => 'std.tpl',
'header' =>'header.tpl',
'leftnav' =>'leftNavigation.tpl',
'content' =>'searchbody.tpl'));
//$tpl->set_var('title', 'Lets watch Plays');
$tpl->parse('header', 'header');
$tpl->parse('leftnav', 'leftnav');
$tpl->parse('content', 'content');
$tpl->parse('DUMMY', 'std');
$tpl->p('DUMMY');
?>
in hear i have called searchbody.tpl as the content part. what my problem is whether u do it like that or just do the searchbody design in an html page.
is this right? i'm bit confused coz when u r doing the validation using java script (client side scripting) then i will have to do them in the searchbody.tpl file.
if so do we have to do like this for each page.
To tell u the truth i have already design all the pages like this. now i'm bit afraid it's not the way u do it!
please reply me if u can. will be a great help
thanks
saj