include_once navigation question

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

Post Reply
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

include_once navigation question

Post by Sindarin »

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?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

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);
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Post by Sindarin »

And what should be at the <a href> of a menu item?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

foo.php?page=blahblah
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Post by Sindarin »

Thanks, it works like a charm. I wonder if it will work from a flash movie. I'll have to try later, thanks again!
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Post by Sindarin »

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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

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.
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post by phpdevuk »

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
Post Reply