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
RadioButtonList data selection
view plaincopy to clipboardprint?Auto fill in input value based on User_ID
Hello,
I'm looking form some input on the following problem.
User loads page ->
shift numbers with paging
Hi
How would i be able to display 10 numbers 1 2 3 4 5 6 7 8 9 10
and when I click next
Typing math
I've added support for typesetting math using LaTeX on the forums.
Example:
Code: [Select]
Attempt to assign property of non-object in...
I'm having issues with the following function in PHP 5...
function getTreeWithChildre
Forum tutorial
Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For no
Batch Related Pricing
Hi, I need some clarity on the batch related pricing
For example the following are the b
HTML Form Server Side Validation
Hi, Im new here, im currently doing a website for a friend, and I have designed using snippets from
Help with forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter
Can I use a loop
Hi buddies!
Once again with my doubts here.
Right now I am using this sql stat