0

我在 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 ... 的,我需要这个想法的帮助

4

2 回答 2

1

试试这个:

global $app;
$html  = "web solution";
$app->set('JComponentTitle', $html);
于 2011-09-26T18:28:43.340 回答
0

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

$app = & JFactory::getApplication();
$html = 'web solution';
$app->set('JComponentTitle', $html);
于 2012-02-01T15:04:56.953 回答