Making it a function?
- From: "Samuel van Laere" <webkluns@xxxxxxxxxxxx>
- Date: Tue, 5 May 2009 12:05:56 +0200
Hi,
I use the code below on my website, straight in the index page (not as a
function that is) and it works just fine.
But when I make it a function:
function LaadPagina()
{
// the code
}
put it in a seperate script, include it and next call the function:
LaadPagina();
It won't work, no page gets loaded, no PHP errors either.
Why won't it work when made in a function?
Cheers,
Samuel -code below -
<?php
$toegestaan = array("index", "doel", "gastenboek", "sponsors", "links",
"doel", "dagboek", "giften", "parcours", "contact", "fotoalbum");
$bestand = './pgn/' . $_GET['id'] . '.php';
if (in_array($_GET['id'], $toegestaan)) {
if (file_exists($bestand)) {
include($bestand);
} else {
$titel = '404 - Bestand niet gevonden.';
$kop = 'Ojee een 404 :(';
$inhoud = '<p>404 - Bestand niet gevonden.</p>';
}
} elseif (!isset($_GET['id'])) {
if (file_exists('./pgn/index.php')) {
include('./pgn/index.php');
}
} else {
header("HTTP/1.0 404 Not Found");
$titel = '404 - Bestand niet gevonden.';
$kop = 'Ojee een 404 :(';
$inhoud = '<p>404 - Bestand niet gevonden.</p>';
}
return $titel;
return $kop;
return $inhoud;
?>
But
.
- Follow-Ups:
- Re: Making it a function?
- From: Jerry Stuckle
- Re: Making it a function?
- From: Erwin Moller
- Re: Making it a function?
- From: Jay Somerset
- Re: Making it a function?
- Prev by Date: Re: phpnub | Counting
- Next by Date: Re: Making it a function?
- Previous by thread: phpnub | Counting
- Next by thread: Re: Making it a function?
- Index(es):
Relevant Pages
|