我正在使用Joomla 3.0,但此时由于一个小问题,我无法使用组件。
这是错误,我可以通过向此类JView
添加Legacy而轻松解决的所有其他错误变为JViewLegacy
然而,对于下面的错误,我找不到解决方案:
任何帮助都会很棒!
错误:
Fatal error: Call to a member function getParams() on a non-object in
/var/www/g35003/mywebsite.nl/HTML/administrator/components/
com_taxonomy/taxonomy.php on line 16
代码行16已标记。
defined( '_JEXEC' ) or die( 'Restricted access' );
global $mainframe;
$params = $app->getParams(); /** <-- Line 16 */
require_once (JPATH_COMPONENT.DS.'controller.php');
$controller = new TaxonomyController();
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
答案 0 :(得分:11)
global $mainframe;
已被弃用。要获取参数,可以使用以下代码:
$params = JComponentHelper::getParams('com_taxonomy');
$test = $params->get('param_name');
答案 1 :(得分:0)
试试这个
defined( '_JEXEC' ) or die( 'Restricted access' );
$app = &JFactory::getApplication();
$params = $app->getParams(); /** <-- Line 16 */
require_once (JPATH_COMPONENT.DS.'controller.php');
$controller = new TaxonomyController();
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
答案 2 :(得分:0)
为了在我的视图中获取菜单项的参数,我使用了以下内容:
$menu = JFactory::getApplication('site')->getMenu()->getActive();
$this->params = $menu->params;