PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
JKM
Forum Contributor
Posts: 221 Joined: Tue Jun 17, 2008 8:12 pm
Post
by JKM » Wed Aug 27, 2008 5:35 pm
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.
ghurtado
Forum Contributor
Posts: 334 Joined: Wed Jul 23, 2008 12:19 pm
Post
by ghurtado » Wed Aug 27, 2008 6:01 pm
Try anything yet?
Bill H
DevNet Resident
Posts: 1136 Joined: Sat Jun 01, 2002 10:16 am
Location: San Diego CA
Contact:
Post
by Bill H » Thu Aug 28, 2008 12:08 am
Homework?
JKM
Forum Contributor
Posts: 221 Joined: Tue Jun 17, 2008 8:12 pm
Post
by JKM » Thu Aug 28, 2008 1:59 am
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';
}
}
?>