Adil
DevBest CEO
- May 28, 2011
- 1,276
- 714
Hello. I've recently been working on a minimal php framework/web system and I have this basic function:
That is my handler for different urls, so instead of making a page for each template page (e.g you have foo.html in your views folder, and then you must have foo.php in your root folder), it uses a single page with some url rewriting.
My question is, would it be better to use:
Using my current system ($tpl->AddTPL()), I can include the file but it also includes my original index page. E.g, if I have "adil" on my index page, and "blah" on my register page, when I navigate to index.php?p=register, it will have "adil blah".
If I were to use $tpl->AddTPL(), how would I go about "deleting" the index content and only throwing out the requested page content?
Help would be greatly appreciated
-Adil
PHP:
<?php
public function handleCall()
{
if(isset($_GET['p']))
{
switch($_GET['p'])
{
case 'about':
$tpl->AddTPL('about');
break;
case 'contact':
$tpl->AddTPL('contact');
break;
}
}
}
?>
That is my handler for different urls, so instead of making a page for each template page (e.g you have foo.html in your views folder, and then you must have foo.php in your root folder), it uses a single page with some url rewriting.
My question is, would it be better to use:
PHP:
include('mypage.html');
//instead of
$tpl->AddTPL('mypage');
Using my current system ($tpl->AddTPL()), I can include the file but it also includes my original index page. E.g, if I have "adil" on my index page, and "blah" on my register page, when I navigate to index.php?p=register, it will have "adil blah".
If I were to use $tpl->AddTPL(), how would I go about "deleting" the index content and only throwing out the requested page content?
Help would be greatly appreciated
-Adil