Re: Making it a function?



On Tue, 5 May 2009 12:05:56 +0200, "Samuel van Laere"
<webkluns@xxxxxxxxxxxx> wrote:

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


Perhaps because it never gets interpreted, only loaded. Not sure
there is a way to put php in a loadable script. Someone more expert
than I might want to comment.
--
Jay (remove dashes for legal email address)
.