Problem with "dynamic" index page
Posted on
16th Feb 2014 07:03 pm by
admin
Hi. I have one question. In my index.php page I have this kind of code:
Code: // listaa sivut
$pages = Array (
"etusivu" => "etusivu.php",,
"linkit" => "linkit.php",
"yhteydet" => "yhteydet.php",
"tiedotteet" => "tiedote.php",
"uutiset" => "uutiset.php",
"tapahtumat" => "tapahtumat.php",
);
// Jos sivua ei loydy, naytetaan etusivu
$page = ($_GET["page"] != "") ? $_GET["page"] : "etusivu";
if (isset($pages[$page]) AND file_exists($pages[$page])) {
include ($pages[$page]);
} else {
// Jotakin vaarin! naytetaan 404-viesti
echo "Virhe 404 - Sivua ei löydy!";
}
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 . "/");
} else {
$pages[ereg_replace(".(.*)$", "", $file)] = $dir . $file;
}
}
}
CloseDir ($handle);
}
?>
Ewerything else works ok, but I want put in $pages array page tapahtumat&page=2. How to do it?
I mean that this addres works in index php:
www.mydomain.com/index.php?page=tapahtumat
This addres does not work:
www.mydomain.com/index.php?page=tapahtumat&page=2
What I have to do?
No comments posted yet
Your Answer:
Login to answer
195
47
Other forums
close site for maintenance
i get a tutorial, saying the following code can put our site offline, and only the developer can vie
Displaying image pathname instead of image
Hello
Im trying to upload and then display images from a mysql database - Its only basic and
Multipe Dynamic Controls & AutoPostback Issue
I currently have a need to create many dynamic controls (Example Textboxes) that need to do a PostBa
FlashVar function how to insert variables
Hi guys. Im new in this forum and also new in php programming. Can you help me about this code?
<
a multi dimensional array with for each
hi, I have been asked to write an array, I have Zone 2,3,4,5,6,7,8 each zone has 3 sections of weigh
Auto install
Hi I have a directory lets say "apps" that I then have more folders ie "email",
Packet Design
Hi All,
Im new about network programming and I want to design a protocol but I have some question
Undefined variable: adHTML
Hello:
While checking my site error logs, I've noticed one repetitive error that fills the lo
New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understan
Email Form Syntax Issue
I need the TO: in email to display To: CEO instead of To: abc@mail.com
How to alter the scri