带有PHP 7的Joomla 3.8

时间:2018-10-25 16:25:30

标签: php web joomla

我目前正在为我的网站从PHP 5.6强制转换到7.1(或7.2,两者都是一个选择)。我有两个网站,一个工作正常,但另一个不在7.1或2上运行。

我收到以下错误消息:

[Thu Oct 25 09:25:21.985120 2018] [:error] [pid 12006] PHP Deprecated: Non-static method Joomla\\CMS\\Application\\CMSApplication::getMenu() should not be called statically, assuming $this from incompatible context in /home/public/sites/www.modderaandebanden.nl/libraries/src/Application/SiteApplication.php on line 275
[Thu Oct 25 09:25:21.985130 2018] [:error] [pid 12006] PHP Strict Standards: Only variables should be assigned by reference in /home/public/sites/www.modderaandebanden.nl/templates/siteground-j16-1/templates.php on line 15

我在所有页面上都遇到了问题(它始终使用相同的模板)。这是我打开当前正在使用的Siteground J16-1模板的templates.php时得到的:

<?if( $sg == 'banner' ):?>

    <?php if (JRequest::getVar('view') == 'frontpage'):?>

    <!-- SIDE BEGIN --><!-- SIDE END -->

    <?php endif?>

<?else:?>

    <?php echo $app->getCfg('sitename'); ?>, Powered by <a href="http://joomla.org/" class="sgfooter" target="_blank">Joomla!</a>



    <?php $menu = &JSite::getMenu();

    if ($menu->getActive() == $menu->getDefault()) :?>

        <!-- FOOTER BEGIN --><a href="http://www.siteground.com/cpanel-hosting.htm" target="_blank">Hosting with cPanel by SiteGround</a><!-- FOOTER END -->

    <?php endif ?>



<?endif;?>

请让我知道这是否可以解决问题。请原谅我的烦恼... :-D

www.modderaandebanden.nl是我的网站。

有人可以告诉我这是怎么回事。是不适合PHP 7使用的模板吗?

预先感谢

1 个答案:

答案 0 :(得分:1)

这是警告和注意。这不是错误!

通常,您可以将其隐藏:Joomla配置>服务器选项卡>错误报告-将其设置为最小值或不设置。

您还可以在服务器php.ini配置文件中修改此设置,或在网站根文件夹的php.ini文件中设置此设置(仅在某些服务器上可用)。

但是最后您应​​该修复代码以使用新的Joomla Framework方法。 例如,要获取菜单,请使用:

// Get Joomla! instance
$jAp = JFactory::getApplication();
// Get variables
$menu = $jAp->getMenu();

然后查看Get vars: https://docs.joomla.org/Retrieving_request_data_using_JInput