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
b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)
[newb] Image hosting help.
Hey there, I'm new to php, I know some basics and i can code PWN, I'm only 14 but I'm interested in
Create comparison matrix?
I want to create a comparison script for forum software and was wondering is there any tutorial or b
Preg_match question
I want to use preg_match to make sure a string is always 6 characters long and only contains 0-9 and
Save remote XML to local website folder
Hi, I hope you can help me out. I would like to be able to pull an XML file from another site and t
Implementing Single Sign-On using SAML 1.1, x.509, LDAP in C#.net
Hi,
I got a requirement from the client i.e implementing single sing on using SAML 1.1( LDAP &
Retreiving objects from Sessions
Hi all,
I am getting really frustrated with storing and retreiving objects from a session. Bu
Can I use a loop
Hi buddies!
Once again with my doubts here.
Right now I am using this sql stat
To change the name of label on SAP screen XK02.
Hi All,
Can one suggest me how to change the label of an input field of a sap standard s
Guixt issue
Hello all,
We are experiencing the following problem with Guixt:
Some transact