I met some trouble with a function.
In fact I would like to include all my pages, but the thing is that not all pages are named like the param $_GET['page']
for example if I call index.php?p=accueil
it will redirect to php/home.php
an other example if I call index.php?p=message
it will redirect transparently to message.php
For all exceptions I've generated an array like that:
<?php
$paramListepages = array(
'corbeille' => array(
'libelle' => 'corbeille',
'page' => 'php/trash.php'
),
'nouveaumessage' => array(
'libelle' => 'nouveaumessage',
'page' => 'php/envoyer.php'
)
);
?>
This array contain many sub_arrays As you can see the 2 firsts of this one.
For calling pages I've done a function like that:
function getPage($var) {
if (!isset($var)){
//Aucune page spécifiée => default page
inlude('php/accueil.php');
}
elseif (array_key_exists($var,$paramListepages)){
// page trouvée => on l'inclut!
include ('php/accueil.php');
}
else{
// page espectant la structure, non trouvée dans l'array => on l'inclut directement
include('php/'.$var.'.php');
}
}
actualy it seems to recognise the if condition and the else.
But when I ask for a page in the array, there is a blank page It seems to not be able to read the correct value expected.
I have white empty pages with no mistake or message error.
In my Ubuntu I've activated the error_reporting(E_ALL);
Any kind of help will be much appreciated