Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-14-2005, 12:58 AM   PM User | #1
jakerbug
New Coder

 
Join Date: Mar 2004
Location: New Jersey
Posts: 70
Thanks: 2
Thanked 1 Time in 1 Post
jakerbug is an unknown quantity at this point
Is this a stupid way to do this... (iframe substitute)

I use this code:

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
jakerbug is offline   Reply With Quote
Old 06-14-2005, 01:55 AM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
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.

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

__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:42 AM.


Advertisement
Log in to turn off these ads.