Answer the question
In order to leave comments, you need to log in
Why are there problems with the output of snippets in MODX Revolution through chunks?
There is MODX Revolution 2.7.1. This is not the first time (and on previous versions of modx) there are problems with the output of snippets. I can't understand why the snippet "breaks" and how to fix it.
Here is the code:
Answer the question
In order to leave comments, you need to log in
For the time being, I've been "shackled", I hope that the reason and the solution will be found.
Created snippet "snippetRunner":
<?php
if(empty($snippet)){
return;
}
if(!empty($params)){
$params = str_replace("`", "", $params);
$params = json_decode($params, true);
foreach($params as $key => $value){
if(strpos($key, "htmldecode_") !== false){
$params[str_replace("htmldecode_", "", $key)] = htmlspecialchars_decode($value);
}
}
}
$content = $modx->runSnippet($snippet, !empty($params) ? $params : []);
return !empty($content) ? $content : (!empty($params["if_empty"]) ? $params["if_empty"] : "");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question