I am hoping someone can help me with my prediciment. Basically what I am having trouble with is as follows:
I have created a templated site, with the use of switch statements [shown below]
Anyway, this works fine, accept the person I am doing this for knows little html so what I want to do is be able for him to add new sections easily without doing any HTML, thus the MySQL DB.
I have the navigation in two arrays (below),
What I forgot to mention was basically I have a 404 error handler in the switch so if the sectionName doesn't exist as a case statement, they will be brought to an error 404 page.
So what I have to do is get section names that he enters in the DB to somehow get into the switch statement so that it is a valid section.
But I am stumped what is the best way to do this?? I would be very grateful if someone can help..
Thank you In advance,
Stan
PHP:--------------------------------------------------------------------------------
$alist=array("about","products","faq","stories");
$alist_alias=array("ABOUT US","PRODUCTS & SERVICES","FAQ","SUCCESS STORIES");
$blist=array("news","links","contact");
$blist_alias=array("NEWS ROOM","LINKS","CONTACT US");
PHP:--------------------------------------------------------------------------------
<?
switch($sectionName)
{
case "home":
$contentName="home";
$pageTitle="Home";
break;
case "about":
$contentName="about";
$pageTitle="About Us;";
break;
case "products":
$contentName="products";
$pageTitle="Products & Services";
break;
case "faq":
$contentName="faq";
$pageTitle="Frequently Asked Questions";
break;
case "stories":
$contentName="stories";
$pageTitle="Success Stories";
break;
case "news":
$contentName="news";
$pageTitle="News Room";
break;
case "viewart":
$contentName="viewart";
$pageTitle="News Room";
break;
case "link":
$contentName="link";
$pageTitle="Links";
break;
case "contact":
$contentName="contact";
$pageTitle="Contact Us";
break;
case "":
$contentName="home";
$pageTitle="Home";
break;
default:
$contentName="404";
$pageTitle="Error 404";
}
?>
<head>
<title>Index Page</title>
</head>
<body>
<? include("content/$contentName.php"); ?>
</body>