Answer the question
In order to leave comments, you need to log in
How to make PHPStorm indent HTML string inside PHP code?
Hello!
There is code that PHPStorm formats like this:
<div id="<?=$id?>">
<? foreach ($arResult["ITEMS"] as $arElement):
if ($arElement['PROPERTY_KEY_G_VALUE']) : ?>
<a rel="rondell" href="#" title="<?=$arElement["NAME"]?>>">
<? else : ?>
<? endif ?>
<? endforeach ?>
</div>
<div id="<?=$id?>">
<? foreach ($arResult["ITEMS"] as $arElement):
if ($arElement['PROPERTY_KEY_G_VALUE']) : ?>
<a rel="rondell" href="#" title="<?=$arElement["NAME"]?>>">
<? else : ?>
<a rel="rondell" href="123123" title="<?=$arElement["NAME"]?>>">
<? endif ?>
<? endforeach ?>
</div>
Answer the question
In order to leave comments, you need to log in
This is bad design, there shouldn't be HTML inside PHP code.
Add another level of abstraction in the form of a templating engine (eg Smarty).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question