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
Sindarin
Forum Regular
Posts: 521 Joined: Tue Sep 25, 2007 8:36 am
Location: Greece
Post
by Sindarin » Thu Sep 27, 2007 7:50 am
I am using
Code: Select all
<?php include_once("overhauling.php");?> to include some content in a page layout (yeah I used iframe first but the client didn't like the scrollbar that popped in, in long pages),
Now I have a menu at the left which navigates to another page. How can I make that it navigates to another pages by changing include_once?
Zoxive
Forum Regular
Posts: 974 Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan
Post
by Zoxive » Thu Sep 27, 2007 8:10 am
Very Simple Controller
Code: Select all
switch($_GET['page']){
case 'home':
$include = 'home.php';
break;
case 'anotherpage':
$include = 'test.php';
break;
default:
$include = '404.php';
}
include($include);
Sindarin
Forum Regular
Posts: 521 Joined: Tue Sep 25, 2007 8:36 am
Location: Greece
Post
by Sindarin » Thu Sep 27, 2007 8:13 am
And what should be at the <a href> of a menu item?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Thu Sep 27, 2007 8:28 am
foo.php?page=blahblah
Sindarin
Forum Regular
Posts: 521 Joined: Tue Sep 25, 2007 8:36 am
Location: Greece
Post
by Sindarin » Thu Sep 27, 2007 8:49 am
Thanks, it works like a charm. I wonder if it will work from a flash movie. I'll have to try later, thanks again!
Sindarin
Forum Regular
Posts: 521 Joined: Tue Sep 25, 2007 8:36 am
Location: Greece
Post
by Sindarin » Mon Oct 01, 2007 9:38 am
It works with flash too.
foo.php?page=blahblah
Another question would be how to set two or more different variables in order to use in another switch.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Oct 01, 2007 9:46 am
In HTML it would be
foo.php?variable1=one&variable2=two
In flash it's probably a simple & instead of &, but I don't know for sure.
phpdevuk
Forum Contributor
Posts: 220 Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:
Post
by phpdevuk » Mon Oct 01, 2007 9:56 am
if you are going to use urls like that you might want to consider using mod rewrite on apache and .htaccess to make the urls cleaner