Je reçois "Erreur irrécupérable: Appel à la fonction non définie getSContent()" avec le code inclus mais ... comme vous pouvez le voir: Ma fonction est là!Pourquoi j'obtiens une erreur de "fonction manquante"? Ma fonction est juste là!
S'il vous plaît, aidez. Je suis sûr que j'ai besoin de dormir.
class InfoController extends AppController {
var $name = 'Info';
var $helpers = array('Html', 'Session');
var $uses = array();
function display() {
$path = func_get_args();
$section = $path[0];
$mainMenuActiveElement = $section;
$sectionContent = getSContent($section);
$this->set(compact('section', 'mainMenuActiveElement', 'sectionContent'));
$this->render('/pages/info');
}
function getSContent($section) {
$sectionContent = '';
switch ($section) {
case 'bases':
$sectionContent = 'some content';
break;
case 'informacion':
$sectionContent = 'some other content';
break;
}
return $sectionContent;
}
}
Oh! J'ai vraiment besoin d'aller dormir. Merci @VolkerK! – vmarquez
Et je suis vraiment désolé pour la partie "ne suppose pas ... implicitement" ;-) Voir http://en.wikipedia.org/wiki/Name_resolution – VolkerK
Cela n'aurait pas de sens en PHP. Voir http://stackoverflow.com/questions/3345408/what-is-the-point-of-having-this-and-self-in-php/3376490#3376490 – Artefacto