Hello. I'm in the process to move all my web pages from flat text based files over to mysql tables and view/edit/add/delete the files with PHP.
That part works ok.
The problem is that on my old flat file based website I have a PHP script on the main index.php file where I include all other pages with linking like : index.php?cat=...
This works perfect with the flat files, but when I try to get information from the mysql tables with php, I try the following : index.php?cat=..../..../index.php?id=$id
It doesnt works. In other words, I cant get out the info from my mysql tables into my old php navigation system. It took me a real long time to get the old navigation system the way I wanted it, so if possible I would like to keep it. I wonder if there are any smart heads out there who knows how to solve this ?
Or maby I have to rewrite a complete new navigation system ?
Below is the main index.php file :
<?php $cat=$_GET['cat']; ?>
<!-- Main Table -->
<table>
<tr>
<td valign=top>
<!-- Navigation page, left side -->
<?php require ("nav.php"); ?>
</td>
<!-- Right side, content -->
<td valign=top width=100%>
<!-- Title Start -->
<table><tr><td height=20>
<?php
preg_match("/[^\/]*$/",$cat,$finn);
print (substr(ucfirst($finn[0]),0,-4));
?>
</td></tr></table>
<!-- Title End -->
<!-- Content Start -->
<table width=100% height=510><td>
<!-- Navigation core -->
<?php
if(isset($cat) and file_exists($cat)) {
include("$cat");
} else {
include("./home.php");
}
?>
</td></table>
Below is the navigation page :
<?php
$myFiles=array();
$homedir = "filer";
$dir = opendir("$homedir");
while(FALSE !== ($file = readdir($dir))) {
if($file=="."||$file==".."||ereg(".htaccess|index", $file)) {
} else {
$myFiles[] = "$file";
}} closedir($dir);
sort($myFiles);
reset($myFiles);
$active=preg_replace("/^.*\/([^\/]+)\.php$/","$1",$cat);
foreach($myFiles as $file) {
if ($file!=$active) {
print "<tr><td><a href=index.php?cat=filer/$file/$file.php><font color=green>".ucfirst($file)."</font></a></td></tr>";
} else {
print "<tr><td class=nav2><a href=index.php?cat=filer/$file/$file.php> ".ucfirst($file)."</a></td></tr>";
}}
?>