Public feed
#603073
<div id="navigaatio">
<font face="Arial" color="#FFFFFF" size="2">
<img src="kuvat/navigaatio2_top.png">
<?php
// Here you have to list every page you want that can be loaded
$pages = Array (
"navigaatio_vaaka" => "includes/navigaatio_vaaka.php",
"navigaatio" => "includes/navigaatio.php"
);
// We check if there is page given. If not by default we load index.php
$page = ($_GET["page"] != "") ? $_GET["page"] : "index";
// Lets check that the file exists and it is in $pages array
if (isset($pages[$page]) AND file_exists($pages[$page])) {
// Everything's allright lets load the page
include ($pages[$page]);
} else {
// Somethings wrong! We show error message
echo "Error 404 - The page cannot be found.";
}
/*
* If you think you have like 100 pages and you don't want to write
* the array manually. Here's the solution for you.
*
* function MakeArray (String handle)
*
* Example:
* MakeArray ("/home/jope/public_html/my_pages/loads/");
*
* Then you have an array to use with Page load system. Remember the ending slash!
*
* Use this function with caution! Check the directory which you turn
* into array that it doesn't include any UNWANTED files.
*
*/
function MakeArray ($dir) {
global $pages;
$handle = OpenDir ($dir) or die ("Couldn't open $handle!");
while (FALSE !== ($file = ReadDir($handle))) {
if ($file != ".." AND $file != ".") {
if (is_dir($dir . $file)) {
MakeArray ($dir . $file . "/includes");
} else {
$pages[ereg_replace("\.(.*)$", "", $file)] = $dir . $file;
}
}
}
CloseDir ($handle);
}
?>
<img src="kuvat/navigaatio2_bottom.png">
</font>
</div>