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

问题描述 投票:10回答:2

我是joomla的新手。当我把我的模板改成其他喜欢 http:/www.joomla24.comJoomla_3x_TemplatesJoomla_3x_TemplatesOliverio_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
joomla3.0
2个回答
32
投票

这很简单。你的模板调用了一个名为 getMenu() 静态地。意思是这个调用看起来像这样。$app::getMenu(). 但它应该是这样的。$app->getMenu(). 变量名($app)不重要,冒号与箭头很重要。

正确的方法是:菜单。

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

或者更短。

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

-1
投票

同时配置php.ini中的error_reporting功能

error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
© www.soinside.com 2019 - 2024. All rights reserved.