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 Like 47 Dislike
Previous forums Next forums
Other forums

redirect standard error and assert (how to?)
How do you redirect standard error and assert?

---

(Why? I am creating an web app and

user administration
Dear @all,

what I have to do to set the user defaults for new users. At the moment I woul

does anyone know a php script to send mail using gmails/googles free smtp server
cause i heard u can do that but i dont know how

noob cURL help
I have a pretty basic form that I need to cURL post to a file in my includes folder (includes/login.

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

please help me in this update statment
hi every one

if I have table and this data in it

id name
10

distinct rows
Hi
version 10.2.0.3

I have a query output something like the following

ID

trim function issues
Hi guys, total noob here...

So I've been tinkering around with a html and am using php to em

Weird problem with SELECT command..Help!
Hi!

It seems I'm having a really weird problem with SQL SELECT command....I have table into a

Contents of variable not echoing
Hey guys, hopefully this is an easy one...

In this line, the variables are not echoing out. T

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash