for a long time I have been using a snippet to include external files as templates and chunks. I found this snippet in an older forum. But since I’ve been working with Modx 3 and PHP 8, the snippet no longer works. It works only one my frontpage but the subpages are all blank pages now.
This is the snippet I have used so far:
# Snippet to include template files from file system
# usage: [[includeTemplate? &tpl=`template.tpl`]]
if (!isset($tpl)||$tpl=="") return "Missing Template file!";
$tpl = $base_path .'assets/templates/page/'.$tpl;
I think this code has just to be updated for php 8. Is there anyone who could help me with this?
Thank you Harry,
I have changed this as you wrote, but I still have the same issue with the subpages. They all are still blank.
In PHP 7.4 I don’t have this issue. Could it be that because of PHP 8 I have to adapt the code somehow? Unfortunately, I am not familiar with PHP. So far I have done very little.
Or have I done something wrong with this? $tpl = $modx->getOption('base_path') .'assets/templates/page/'.$tpl;
Could you rewrite the whole code so that it would work with PHP 8?
What I mean with Subpages: “further down in the resource tree”. That code works only on the startpage. All others are blank.
You can see it here. - This is a page of my old neighbour.His provider wants to switch off PHP 7.4 in November so that I have to fix that code.
I have been helping him for years for free but this is over my skils
You don’t have to do it for free. I would even donate a coffee to you or someone else via Paypal if you agree.
Ps: I tried the static solution from Modx before in another project, and then I saw that I would have to rebuild everything in this projekt (link) because the nested templates would no longer work.
As I wrote, I don’t get anything from that and I’m tired to start everything again.
Thanx a lot Harry for your time and effort!
I’ll have a look at the plugins. Maybe I can locate the error there. If a snippet or plugin is causing the problem I will get back to you and this topic can be closed than.
I have just done what you and Harry said and I found out that none of the plugins I use cause this error. It was a Snippet called “siblingsnav” - a prev next navigation from
bruno17. I will check on githup if this problem is already known and report it if necessary.
Thanx for all of your help!