【问题标题】:Error $mainframe->set() in joomla 1.7joomla 1.7 中的错误 $mainframe->set()
【发布时间】:2011-11-25 02:13:22
【问题描述】:

我在 joomla 1.5 中有代码

global $mainframe;
$html  = "web solution";
$mainframe->set('JComponentTitle', $html);

在 joomla 1.5 中使用是可以的 但是当使用 joomla 1.7 是错误Call to a member function set() on a non-object in ... 我需要这个想法的帮助

【问题讨论】:

    标签: joomla1.7


    【解决方案1】:

    试试这个:

    global $app;
    $html  = "web solution";
    $app->set('JComponentTitle', $html);
    

    【讨论】:

      【解决方案2】:

      我认为在 joomla 1.6+ 中使用全局对象已被弃用。而不是使用 $mainframe 和 global $app,我会使用类似的东西:

      $app = & JFactory::getApplication();
      $html = 'web solution';
      $app->set('JComponentTitle', $html);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-24
        • 1970-01-01
        • 2013-08-28
        • 2012-04-30
        相关资源
        最近更新 更多