I'm looking at/testing some of OldNema's templates. Some of them I used for a few clients. Most templates work fine with php7.2.13 and the latest cmsimple version, however one of them 'ferrariclub' is completely blocked..
There are a significant number of php errors. It seems that something is wrong in the combination of the template and the "xtoc menu", more specifically the vertical one.
Now, unfortunately I don't understand much of php programming, but is is weird that the 'pizza' template, which also uses 'xtoc', but in the horizontal form, has no problems at all.
I'm worried because I used the "Ferrari template" for a client, so as soon as the hosting provider stops with older php version, website is 'gone'. And that's a website of significant size..
Is there an 'easy' solution within the community?
Take a look:
Working fine : https://walhalles.be/pizza/
Big trouble here : https://walhalles.be/ferrari
Thanks in advance for your time.
Grtz
Some older templates problem with php 7.2.13
Moderator: mikey
Re: Some older templates problem with php 7.2.13
The fix should be as simple as replacing line 14 of xtoc.php with:
Code: Select all
function xtoc($start = null, $end = null) {global $c, $cl, $s, $l, $cf;$ta = array();if (isset($start)) {if (!isset($end))$end = $start;}else $start = 1;if (!isset($end))$end = $cf['menu']['levels'];$ta = array();if ($s > -1) {$tl = $l[$s];for($i = $s; $i > -1; $i--) { if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)if(!hide($i))$ta[] = $i;if ($l[$i] < $tl)$tl = $l[$i];}@sort($ta);$tl = $l[$s];}else $tl = 0;$tl += 1+$cf['menu']['levelcatch'];for($i = $s+1; $i < $cl; $i++) {if ($l[$i] <= $tl && $l[$i] >= $start && $l[$i] <= $end)if(!hide($i))$ta[] = $i; if ($l[$i] < $tl)$tl = $l[$i];}return xli($ta, $start);}
Christoph M. Becker – Plugins for CMSimple_XH
Re: Some older templates problem with php 7.2.13
OMG, this works!
Chapeau pour les ingenieurs, grand respect.
Chapeau pour les ingenieurs, grand respect.
Re: Some older templates problem with php 7.2.13
Fine.
Note that this problem exists as of PHP 7.1.0 (not only PHP 7.2.13), and all existing templates with this potential issue should be fixed, even if they're running on an older PHP version yet. The fix above is compatible with whatever PHP version xtoc is compatible (at least PHP 5.0.0).
Note to self: promote Toxic_XH to GA as soon as possible, since it could be used as replacement for xtoc, keeping such updates in a single place (instead of potentially having to fix all existing templates using xtoc).
Christoph M. Becker – Plugins for CMSimple_XH
Re: Some older templates problem with php 7.2.13
Still a small warning as follows:
XH-DEPRECATED: Function editmenu() is deprecated
/home/walhalles/domains/walhalles.be/public_html/ferrari/templates/ferrariclub/template.htm:45
However, everything works fine, so that should not be a problem?
XH-DEPRECATED: Function editmenu() is deprecated
/home/walhalles/domains/walhalles.be/public_html/ferrari/templates/ferrariclub/template.htm:45
However, everything works fine, so that should not be a problem?
Re: Some older templates problem with php 7.2.13
No, that's not an immediate problem, but since editmenu() does nothing as of CMSimple_XH 1.5, I suggest that you simply delete line 45 of template.htm.
Christoph M. Becker – Plugins for CMSimple_XH