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",,
Did you know?Explore Trending and Topic pages for more stories like this.
"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

Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

Different actions for different parts of a string
<?php
function dosomething($string, $else = '') {
if (empty($else))
$string

BackButton Behaviour in AJAX
I have an ASPX Page AJAX Enabled!The page has a gridView and a DDL for filtering on it. The Gridview

Progress bar tracking file downloads
Hey guys, was wondering if there was a way to track how far a file has been downloaded. I know there

$GPRMC and NMEA how to extract from report
Hi There,

Im a little bi lost and not sure where to start with this one, ive got a small gps

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But

quick question
Hi ..

i have a question
how do i set a var so it displays via an echo
Code: $logo = '&a

how to load a Sys file with system load and call images?
normally you need register the module as a service with CreateService, and start the service

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