Re: Making it a function?

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


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:

It won't work, no page gets loaded, no PHP errors either.

Why won't it work when made in a function?

Samuel -code below -

$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)) {
} 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')) {
} 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;


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)

Relevant Pages

  • Re: Web Animation and Sound Advice Sought
    ... upon someone landing on my website, ... My blog program is a php program that makes use of a mysql database. ... linux (and the linux server supports all sorts of php). ... $500+ Premiere software -- at least on my first brief experimenting ...
  • Re: Furthering my education in OOP - where/how can one learn professional skills?
    ... but I am not proud of the rather amateurish ... implement them in a website. ... is PHP the best language to use to learn and implement the full ... power of OOP? ...
  • Re: Where to define functions as global?
    ... I'm building a website with PHP and MySQL. ... This is a scripting language, ...
  • Re: Restricting access to a website
    ... If, for example, my website is www .lahdedah. ... Yes or no would do and a PHP ... It can all be done in the Apache ... work on a shared server for a number of reasons - like he doesn't have access to the firewall configuration and the firewall is web host blind - it doesn't know that the request should be restricted only for one of the sites on the server, ...
  • Re: Best (most Borland-like) PHP IDE+Debugger?
    ... existed before Borland quit trying to compete with M$'s VisualC. ... Is there anything like it for PHP? ... But it has no debugging capability. ... Manuel's ONLY answers to questions are to see something on his website - and he never identifies it as his website. ...