2013-04-10 63 views
8

我是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 
+0

這是您使用低質量的模板時,遺憾得到了什麼。檢查第91行並將其粘貼到此處,以便我們看到問題所在。 – 2013-04-11 06:59:38

回答

24

這是相當簡單的。您的模板靜態調用名爲getMenu()的函數。意思是這個電話是這樣的:$app::getMenu()。但它應該看起來像這樣:$app->getMenu()。變量名($app)無所謂,冒號vs箭頭很重要。

正確的方式來獲得菜單:

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

甚至更​​短:

$menu = JFactory::getApplication()->getMenu(); 
相關問題