Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2004
    Location
    New Jersey
    Posts
    70
    Thanks
    2
    Thanked 1 Time in 1 Post

    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

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    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');



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •