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