E
E
Evgen2015-11-09 14:06:07
phpstorm
Evgen, 2015-11-09 14:06:07

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>

Want it like this:
<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>

The question is how?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Evgen, 2015-11-09
@EASemashko

Tag not completed

D
Denis Ineshin, 2015-11-09
@IonDen

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 question

Ask a Question

731 491 924 answers to any question