This is a bit of a confusing question I have. I'll try and explain as best as possible.
First I have my index.php page that I use for my layout and navigation. Then I added in a simple php include to where I want my center content to go
Include on index.php
<?php
// Contents in the allowable_page array are php pages that are in the root folder
$allowable_pages=array('all', 'news', 'contact', 'add');
if (isset($_GET['id'])) {
if(in_array($_GET['id'], $allowable_pages) && file_exists($_GET['id'].'.php'))
{
include $_GET['id'].'.php';
}
}else {
include 'all.php';
}
?>
This works fine until my included news page is loaded. I have a page system and it wont work if it's not the main page for some reason. I'be tried renaming the url to index.php?id=news?p=$num but that just outputs a blank page.
Heres the code for the page system on my included news page.
<?php
if (@$_GET['p']!=""){
$page = strip_tags($_GET['p']);
}
else{
$page = 1;
}
$maxperpage = 10;
$page1 = ($page*$maxperpage)-$maxperpage;
$sql = "SELECT * FROM `headlines` WHERE category='News' ORDER BY `date` DESC LIMIT ".$page1.", ".$maxperpage;
$sql2 = mysql_query($sql) or die(mysql_error());
///////////////////////////////////////////////////////////////////////////////
// LOOP TO SAVE NEWS INTO A SINGLE VARIABLE called $servers
///////////////////////////////////////////////////////////////////////////////
?>
<p>Currently we have <b><?=$num?></b> news bits in our database.</p>
<br />
<?
echo $servers;
?>
<p>
<?
if ($page > 1)
{
echo "<center><a href='news.php?p=".($page-1)."'>Past <</a> <b>$page</b> <a href='news.php?p=".($page+1)."'>> Next</a></center></td>";
}
else
{
echo "<center><b>$page</b> <a href='news.php?p=".($page+1)."'>> Next</a></center></td>";
}
?>
As you can see with the above code, I'm not to good with making page systems and don't know how to make it work on the included news page. Any suggestions or ideas on how to fix this?