Very noobish navigation problem..!
Posted: Tue Oct 21, 2003 7:21 am
Hi, needless to say i am totally new to PHP and have only made a small navigation system with it.
I have done a search for an article about my particular problem, but i suspect that it's a ridiculously easy problem to solve since i couldn't find any threads about it.
The problem that i'm having is that at the moment I have a navigation system that reloads the index page with a new content section depending on what you click in the navigation. The code looks like this;
on each link is something like this :
And on the index page is this:
Now as the code is at the moment i need to alter the index file every time i add a new page, adding a new 'if' statement for every new page.
My question is, how can i send a URL as a variable and then have the index page it open that variable as the content, so that i don't need to alter the index page everytime i add a page?? IE;
Have something like this on a link;
and then something like this in the index:
Any help would be greatly appreciated. d(^^)b
>>>> Edit >>>>>
Ok the link code works like this;
and on the index i have put this;
but when i go to the index i get this error,
I have done a search for an article about my particular problem, but i suspect that it's a ridiculously easy problem to solve since i couldn't find any threads about it.
The problem that i'm having is that at the moment I have a navigation system that reloads the index page with a new content section depending on what you click in the navigation. The code looks like this;
on each link is something like this :
Code: Select all
<a href="index.php?page=blog">-
Personal blog</a>Code: Select all
<?php
if ($page==blog) {
include "cc/blog/blog.php";
}
if ($page==epc) {
include "tutorials/flash/epc.php";
}
if ($page==news) {
include "news/news.php";
}
if ($page==about) {
include "about/about.php";
}
if ($page==null) {
include "news/news.php";
}
?>My question is, how can i send a URL as a variable and then have the index page it open that variable as the content, so that i don't need to alter the index page everytime i add a page?? IE;
Have something like this on a link;
Code: Select all
<a href="index.php?page=news/news.php">-
News</a>Code: Select all
<?php
if ($page == null){
$page = news/news.php
}
include $page
}>>>> Edit >>>>>
Ok the link code works like this;
Code: Select all
<a href="index.php?page=news/news.php">-
News</a>Code: Select all
<?php
if ($page == null){
$page = news/news.php
}
include $page
}the pages load in fine from the the navigation, but it is just when i load up the index for the first time that i get this error.Warning: Division by zero in /home/virtual/site47/fst/var/www/html/index2.php on line 112