Page 1 of 1

Include script

Posted: Wed Aug 27, 2008 5:35 pm
by JKM
Hello,

I wan't an include script that does the following thing, and I wondered if someone could help me out.
  • It's three separate folders - 'hello', 'hi' and 'bye'.
  • index.php should show lol.php
  • index.php?p=hello should show /hello/index.php and so on.
  • index.php?p=hello&page=1 should show /hello/index_2.php and so on.
  • index.php?p=hello&lol=1 should show /hello/lol_1.php and so on.

Re: Include script

Posted: Wed Aug 27, 2008 6:01 pm
by ghurtado
Try anything yet?

Re: Include script

Posted: Thu Aug 28, 2008 12:08 am
by Bill H
Homework?

Re: Include script

Posted: Thu Aug 28, 2008 1:59 am
by JKM
I've tried, yes. I think this would work, but I don't know how It can work for both 'hi', 'hello' and 'bye'.

Code: Select all

<?php 
if($_GET['p']){
    $page = (isset($_GET['page'])) ? '_'.$_GET['page'] : '';
    
    if(isset($_GET['hello'])) {
        include 'hello/index.php'
    }
    if(file_exists($_GET['lol'].$page.'.php')) {
        include $_GET['hello/lol'].$page.'.php';
    }
}
?>