Answer the question
In order to leave comments, you need to log in
How to put this php code into a snippet on modx?
Hello!
Zero in php. The template contains the following code. I just can't get it to fit properly into the snippet. Help me please
<?php foreach ($img as $i) { ?>
<div class="b11 v2" data-name="<?=$i?>" style="background-image: url('assets/app/temp/<?=$sid?>/<?=$i?>');" data-state="ok">
<div class="a1"></div>
</div>
<?php } ?>
Answer the question
In order to leave comments, you need to log in
<?php
$text = '';
foreach ($img as $i) {
$text .= '<div class="b11 v2" data-name="' . $i . '" style="background-image: url(\'assets/app/temp/' . $sid . '/' . $i . '\');" data-state="ok"><div class="a1"></div></div>';
}
return $text;
Read the manual, the question is trivial.
php.net/manual/en/ini.core.php#ini.short-open-tag
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question