S
S
serg78ant2017-11-30 11:44:39
NetBeans
serg78ant, 2017-11-30 11:44:39

Netbeans PHP + HTML code formatting?

Netbeans has a great code formatting feature, the command is here: Source -> Format (ALT+SHIFT+F)
This formats code nicely (HTML, PHP, CSS, JS...), but not in case of multi-language (PHP +HTML) code - in this case, most often formatting does not give a good result .
Is there an adequate solution to this problem?
Code example: yadi.sk/d/e_MFK2aT3QBZAB

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
serg78ant, 2017-12-11
@serg78ant

So, to answer my own question:
Netbeans' mixed (PHP+HTML) code formatting only works well when the start/end tag (i.e. "<?" or "?>") is on a line of its own.
Example:
code that will not be properly formatted:

<?if($res == "new") {?>
    <!-- HTML или смешанный код -->
<?}?>

code that will be properly formatted:
<?
if($res == "new") {
?>
    <!-- HTML или смешанный код -->
<?
}
?>

How to do it (transfer all opening/closing PHP tags) is another question .
Such is the feature of code formatting in Netbeans.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question