简体   繁体   中英

Joomla 3.8 with PHP 7problems

I'm currently in the forced transition from PHP 5.6 to 7.1 (or 7.2, both are an option) for my website. I have two websites, the one is working fine but the other isn't running on 7.1 or .2.

I get the following error messages:

[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

I get the problem on all my pages (it uses the same template all around). This is what I get when I open the templates.php of the Siteground J16-1 template I'm currently using:

<?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;?>

Please let me know if this might clarifies the problem. Please excuse my noobiness... :-D

www.modderaandebanden.nl is my site.

Can anybody tell me what's going on here. Is it the template that's not suited to usage with PHP 7?

Thanks in advance

This is warning and notices. This isn't errors !

Normally you can hide that : Joomla configuration > Server tab > Error report -- Set it to minimum or none.

Also you can modify this setting in server php.ini configuration file or set it in a php.ini file in your website root folder (only possible on some servers).

But finally you should fix your code to use new Joomla Framework methods. For example to get menu, use :

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

And look at this for Get vars : https://docs.joomla.org/Retrieving_request_data_using_JInput

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM