Design Question
| From: | Sam Saltis | Date: | Tue, 09 Jul 2002 01:07:21 +0000 |
| Subject: | Design Question | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5234@lists.php.net to get a copy of this message | ||
Hi Everyone,
I have included below a code snippet that I use to drive an application.
Every program calls index.php and passes the action requested as a
parameter. The index.html has an include that inserts the requested
templates... I was looking for some advice as to the pros and cons of
driving an application this way? How would I cache the menu in such a
structure? Will is cause conflicts if the site has a heavy usage?
Cheers,
Sam
index.php
-----------
include("menu.php");
if (empty($action)) {
$action = "";
}
#--------------------------------------------------------------
# Begin Navigational Menu
#--------------------------------------------------------------
switch ($action) {
case "login":
$file = "login.php";
break;
case "action1":
$file = "action2.php";
break;
case "action1":
$file = "action2.php";
break;
default:
$file = "main.php";
break;
}
include("header.php");
include($file);
include("footer.php");
// ------- Display Template -------
$template->assign("template_name",$template_name);
$template->display("index.html");
#--------------------------------------------------------------
# End Navigational Menu
#--------------------------------------------------------------