format-html-in-php
format-html-in-php copied to clipboard
Respecting php identation
<?php
if ($var1){
if (!$var2){
?>
<div class="cla"></div>
<?php
}
}
Formatting the above code produces the following result.
if ($var1){
if (!$var2){
?>
<div class="cla"></div>
<?php
}
}
Is this intended like so?
@ivanbrkicNRLB I'll see what I can do about this, I agree it's annoying.
Dup of #44
I came here looking for a fix to something similar.
Please can you include the cases of if and foreach which at the moment doesn't respect indents.
Thanks

...examples of the sort of indentation that breaks included as screenshot because my comment code inserts are breaking the github editor right now!
// edit -- is this out of scope since its a php indent rather than html? It would be nice if the formatter could just ignore these indents rather than 'correct' them to be at the same level as the surrounding tags
I'm facing the same issue.. Is there any solution ? Please ... @RiFi2k
I also use a lot of alternate syntax and it would be great if nested control structures were indented. VS Code intelliphense does this pretty nicely but can't handle attributes on their own line so at the moment I get either/or.
Wanting:
<?php if ($something == false) : ?>
<?php if (false == true) : ?>
<?php echo 'print something' ?>
<?php endif; ?>
<?php endif; ?>
Currently getting:
<?php if ($something == false) : ?>
<?php if (false == true) : ?>
<?php echo 'print something' ?>
<?php endif; ?>
<?php endif; ?>