...

View Full Version : Is this a stupid way to do this... (iframe substitute)



jakerbug
06-14-2005, 01:58 AM
I use this code:



<?php
switch($_REQUEST['page']) {
case 'maincontent':
case 'carlmtla':
case 'carlyard':
case 'rosayard':
case 'express':
case 'westwind':
case 'banquets':
case 'holidays':
case 'weddings':
case 'contact':
case 'thanks':
case 'carlmtla1menu':
case 'carlmtla2menu':
case 'carlmtla3menu':
case 'carlmtla4menu':
case 'carlmtla5menu':
case 'carlmtla6menu':
case 'carlmtla7menu':
case 'carlmtla8menu':
case 'carlmtla9menu':
case 'carlmtla10menu':
case 'bothgril1menu':
case 'bothgril2menu':
case 'bothgril3menu':
case 'bothgril4menu':
case 'bothgril5menu':
case 'bothgril6menu':
case 'bothgril7menu':
case 'bothgril8menu':
case 'bothgril9menu':
case 'bothgril10menu':
case 'bothgrilssmenu':
case 'rosayard1menu':
case 'rosayard2menu':
case 'rosayard3menu':
case 'rosayard4menu':
case 'rosayard5menu':
case 'rosayard6menu':
case 'rosayard7menu':
case 'rosayard8menu':
case 'rosayard9menu':
case 'rosayard10menu':
case 'rosayard11menu':
case 'rosayard12menu':
case 'bothgrill1menu':
case 'bothgrill2menu':
case 'bothgrill3menu':
case 'bothgrill4menu':
case 'bothgrill5menu':
case 'bothgrill6menu':
case 'bothgrill7menu':
case 'bothgrill8menu':
case 'bothgrill9menu':
case 'bothgrill10menu':
case 'bothgrillssmenu':
case 'express1menu':
case 'express2menu':
case 'express3menu':
case 'express4menu':
case 'express1menu':
include($_REQUEST['page'].'.html');
break;
default:
include('maincontent.html');
break;
}
?>


as kind of an IFRAME substitution. It's already been refined a bit once through a question in this forum, but I still seem to think it's not the best way to do what I'm trying to do...

Do I really need to put every single seperate page in there like that? It just doesn't seem very efficient...

Jake

Nightfire
06-14-2005, 02:55 AM
That's a dodgy way to code it really. Would stick the page variables into an array, then just check if the _get variable matches with what's in the array or not.



$pages = array('maincontent','carlmtla', etc etc);
if(in_array($_REQUEST['page'],$pages)){
include($_REQUEST['page'].'.html');
}else{
include('maincontent.html');
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum