Page 1 of 1

Menu not working in PHP 8+

Posted: Wed Oct 26, 2022 11:45 am
by jello
Hi,

When upgrading my server to PHP 8.1 my menu is suddenly not working. Can anyone guide me/help me?

Version of CMSMS: CMS Made Simple™ 2.2.16 “Truro”
PHP Version 8.1.10

Best, David

----

The error I get:
Fatal error: Uncaught Error: Call to undefined function each() in /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/modules/MenuManager/MenuManager.module.php:111 Stack trace: #0 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/modules/MenuManager/action.default.php(183): MenuManager->GetChildNodes(Object(cms_content_tree), Array, Object(CmsApp), 1, 0, Array, 1, Array, 1) #1 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/classes/class.CMSModule.php(1403): include('/customers/8/0/...') #2 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/classes/class.CMSModule.php(1479): CMSModule->DoAction('default', 'md365e', Array, '15') #3 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/module.functions.php(106): CMSModule->DoActionBase('default', 'md365e', Array, '15', Object(CMS_Smarty_Template)) #4 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/classes/class.CMSModule.php(253): cms_module_plugin(Array, Object(CMS_Smarty_Template)) #5 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/tmp/templates_c/70e60997609f3eba38ab7b26b669ccfd1b81b07a_0.tpl_body.4.php(48): CMSModule::function_plugin(Array, Object(CMS_Smarty_Template)) #6 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/smarty/sysplugins/smarty_template_resource_base.php(128): content_63591a1e180384_59376018(Object(CMS_Smarty_Template)) #7 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/smarty/sysplugins/smarty_template_compiled.php(172): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(CMS_Smarty_Template)) #8 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/smarty/sysplugins/smarty_internal_template.php(206): Smarty_Template_Compiled->render(Object(CMS_Smarty_Template)) #9 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/smarty/sysplugins/smarty_internal_templatebase.php(216): Smarty_Internal_Template->render(false, 0) #10 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/smarty/sysplugins/smarty_internal_templatebase.php(107): Smarty_Internal_TemplateBase->_execute(Object(CMS_Smarty_Template), 'p15', NULL, NULL, 0) #11 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/lib/classes/internal/class.CMS_Smarty_Template.php(20): Smarty_Internal_TemplateBase->fetch(NULL, 'p15', NULL, NULL) #12 /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/index.php(160): CMS_Smarty_Template->fetch() #13 {main} thrown in /customers/8/0/b/gladsaxekirkegaard.dk/httpd.www/modules/MenuManager/MenuManager.module.php on line 111

-----

My template:
{process_pagedata}<!DOCTYPE html>
<!--[if lt IE 7]> <__html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <__html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <__html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <__html class="no-js"> <!--<![endif]-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{title} - {sitename}</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
{metadata}
{cms_stylesheet}
{literal}
<__script__ src="js/vendor/modernizr-2.6.2.min.js"></__script>
<__script__ src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></__script>
<__script__ src="js/plugins.js"></__script>
<__script__ src="js/main.js"></__script>
{/literal}
</head>
</__body>
<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redi ... ">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->

<!-- Content -->
<header>
<div class="container">
<div id="logo">
<a href="/">Gladsaxe Kirkegård</a>
</div>
<div class="lang-search">
<div class="search">
{search resultpage="sogeresultat"}
</div>
</div>
<div class="clear"></div>
</div>
<nav id="nav">
<div class="container">
{menu start_level="1" number_of_levels="3"}
<div class="clear"></div>
</div>
</nav>
</header><!-- END header -->
<div class="container">
<div class="frontpage-slider">
{Showtime2 show='1'}
</div>
<div class="intro-text">
<h2>{title}</h2>
{content}
</div>
<div class="clear"></div>
</div><!-- END container -->

<footer>
<div class="container">
<div class="col-left">
{global_content name='footer'}
</div>
<div class="col-right">
<p><a href="/sitemap">Sitemap</a></p>
</div>
<div class="clear"></div>
</div>
</footer><!-- END footer -->

<!-- Google Analytics -->
{global_content name='analytics'}
<__body>
</__html>

Re: Menu not working in PHP 8+

Posted: Wed Oct 26, 2022 1:21 pm
by DIGI3
MenuManager was deprecated quite some time ago and will not be receiving updates. Your best option is to switch to Navigator.

Re: Menu not working in PHP 8+

Posted: Wed Oct 26, 2022 2:22 pm
by jello
Hi DIGI3,

Thanks a lot -that worked! :)

I was confused by the icon in the Modul Manager, is says "This icon identifies a CMS Made Simple™ system module (module distributed with the CMSMS core)" to the "MenuManager" module. An also the documentation says I should use the {menu} tag:
https://docs.cmsmadesimple.org/layout/d ... e-template

But again, thanks - I really appreciate your help!

Best,
David

Re: Menu not working in PHP 8+

Posted: Wed Oct 26, 2022 4:26 pm
by DIGI3
Thanks, I've updated the docs site (it needs more love but I've updated the {menu} tags to {Navigator} at least)

MenuManager will no longer be shipped with the core soon, but it still is so the icon in Module Manager is correct. It should show as deprecated though - orange text and a red down arrow or something similar.

Re: Menu not working in PHP 8+

Posted: Wed Oct 26, 2022 5:17 pm
by jello
Great - that was fast! :)

Thanks for a super CMS - you work is much appreciated!