我收到“致命错误:调用未定义的函数 getSContent()”,其中包含代码,但是...如您所见:我的函数就在那里!
请帮忙。我确定我需要一些睡眠。
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;
}
}