K
K
kostyaslam2017-03-14 10:57:43
MODX
kostyaslam, 2017-03-14 10:57:43

Why don't PHP statements work in MODX snippet?

Hello! There is a simple task to split a string on a space character.
The call is as follows:

flip snippet code:

$sites = explode(" ", $site);
echo $sites[0];

The $site variable receives the string "naturalbirth.rf bigfamily.rf"
The $sites[0] array element returns the entire string, not the part of the string up to the space.
The same happens with any characters to separate.
If you declare a variable manually, then it normally separates:
$site = "естественныероды.рф большаясемья.рф";
$sites = explode(" ", $site);
echo $sites[0];

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
display: block, 2017-03-14
@qork

Maybe in usr.website  instead of a space?

K
kostyaslam, 2017-03-14
@kostyaslam

Alas, but no

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question