Answer the question
In order to leave comments, you need to log in
Why can a variable contain a different value depending on how it is used?
Hello!
In modx evo, I call the snippet like this:
In the snippet, I have the following code:
var_dump($images);
//string(10) "assets/images/users/c11ab8c3130d794c9c0fbece86402e85.png::||assets/images/users/67f5e9dd2741ccca564d0468352fc8e3.png::||assets/images/users/a0a0ae0d942f01c60fd436555ff8e04c.png::"
var_dump(bin2hex($images));
//string(20) "5b2b696d616765732b5d"
//Эта строка при перекодировании обратно = [+images+]
var_dump(explode('::||', $images));
//array(1) {
// [0]=> string(10) "assets/images/users/c11ab8c3130d794c9c0fbece86402e85.png::||assets/images/users/67f5e9dd2741ccca564d0468352fc8e3.png::||assets/images/users/a0a0ae0d942f01c60fd436555ff8e04c.png::"
//}
Answer the question
In order to leave comments, you need to log in
As I understand it, the $images variable contains a string [+images+]
Just 10 characters long.
All the "excess" that you see is the result of the engine's work on the output.
That is, string(10) "[+images+]"
before issuing it to the browser, it converts tostring(10) : "assets/..."
if you have a TV called 'images' and TV is tied to the template of this page,
then you can call it like this
if TV is taken from a specific page,
then inside the snippet you can get it like this getTemplateVarOutput
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question