Page 1 of 1

include_once navigation question

Posted: Thu Sep 27, 2007 7:50 am
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?

Posted: Thu Sep 27, 2007 8:10 am
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);

Posted: Thu Sep 27, 2007 8:13 am
by Sindarin
And what should be at the <a href> of a menu item?

Posted: Thu Sep 27, 2007 8:28 am
by feyd
foo.php?page=blahblah

Posted: Thu Sep 27, 2007 8:49 am
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!

Posted: Mon Oct 01, 2007 9:38 am
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.

Posted: Mon Oct 01, 2007 9:46 am
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.

Posted: Mon Oct 01, 2007 9:56 am
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