严格标准:非静态方法JSite :: getMenu()不应该被静态调用
问题描述:
我是Joomla的新手。当我改变我的模板,其他类似http://www.joomla24.com/Joomla_3x_Templates/Joomla_3x_Templates/Oliverio_Lite.html严格标准:非静态方法JSite :: getMenu()不应该被静态调用
我收到以下错误
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
答
这是相当简单的。您的模板静态调用名为getMenu()
的函数。意思是这个电话是这样的:$app::getMenu()
。但它应该看起来像这样:$app->getMenu()
。变量名($app
)无所谓,冒号vs箭头很重要。
正确的方式来获得菜单:
$app = JFactory::getApplication();
$menu = $app->getMenu();
甚至更短:
$menu = JFactory::getApplication()->getMenu();
这是您使用低质量的模板时,遗憾得到了什么。检查第91行并将其粘贴到此处,以便我们看到问题所在。 – 2013-04-11 06:59:38