严格标准:不应静态调用非静态方法JSite :: getMenu()

时间:2013-04-10 09:46:15

标签: joomla3.0

我是joomla的新人。当我将模板更改为http://www.joomla24.com/Joomla_3x_Templates/Joomla_3x_Templates/Oliverio_Lite.html

之类的其他模板时

我收到以下错误

Strict Standards: Non-static method JSite::getMenu() should not be called statically, assuming $this from incompatible context in ..\xampp\htdocs\joomla\templates\oliveriolite\index.php on line 91

Strict Standards: Non-static method JApplication::getMenu() should not be called statically, assuming $this from incompatible context in ..\xampp\htdocs\joomla\includes\application.php on line 569

2 个答案:

答案 0 :(得分:27)

这很简单。您的模板静态调用名为getMenu()的函数。这意味着调用如下所示:$app::getMenu()。但它应该是这样的:$app->getMenu()。变量名称($app)无关紧要,冒号与箭头无关紧要。

获取菜单的正确方法是:

$app = JFactory::getApplication();
$menu = $app->getMenu();

甚至更短:

$menu = JFactory::getApplication()->getMenu();

答案 1 :(得分:-1)

还配置php.ini error_reporting可以正常工作

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED