PHP and HTML should indent independently
Is there a way for mixed PHP and HTML to **not** influence each other's indenting? For example:
<?php
$results = blah blah database query
?>
<table>
<?php
while ($row = $results->fetch() ) {
?>
<tr>
<td>
<?php
echo $row[username];
?>
</td>
</tr>
...
The "while" shouldn't be indented, but it is because it's following the HTML's indent level. The "echo" should be one level inside the "while", not three levels as it is here. If the HTML indents, any new PHP follows that indent, and vice-versa -- so PHP and HTML both push each other's indents further over. To me this *greatly* distorts readability. I should be able to look at the PHP indenting and immediately know how deep into PHP **and only PHP's** nesting I am. I want PHP to keeps its own indenting, and HTML keep its own indenting, and never the twain shall meet.
Can this be done in phpStorm?
RELATED: Any time "<?php" or "?>" is alone on a line, I want **no indenting at all** for those lines. There doesn't appear to be any way to do that.
Please sign in to leave a comment.
Nobody? Really? Dang....
yes, i have same question!
we need option to be separate indents for HTML and PHP code
At the moment, there's no way to achieve that, unfortunately. Please vote: https://youtrack.jetbrains.com/issue/WI-44590