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
animation progress while uploading files?
Hello, i have some website form to upload few files to server. i want to put some gif animation whi
List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab
PHP5/Zend 2.0 - Resources
PHP5 Snapshots
http://snaps.php.net/
ZEND 2.0 Feature Overview and Design (PDF File
extract content from a website
i have written a code that will grab the content from the index page..
i would like to know how c
PHP MySQL and DATE
Hi everyone
I have a databse and in one of the columns I have date values such as 2009-March-
Disabling SAP menu
How do I disable SAP menu for all the users and just restrict them to User Menu in SAP ECC 6.0?
PHP webpage & array print issue
I have this code running, and it works perfectly … however, see my bottom bit about what I see
dinamic "textboxes"?
Ey all, my first post here, i hope its not a hard one
I display mysql results in a table
User information
Hi All,
By using t-code SUIM we get all the user details,if suppose we donot have permission t
Find only certain URLs from page ... regex (semi-complete script)
Hi guys,
What I need to do is take a page & extract all the URLs from the page &a