Is there anyway to have Notepad++ highlight both PHP and HTML at the same time?

前端 未结 2 1793
青春惊慌失措
青春惊慌失措 2021-01-19 17:53

I\'ve used Notepad++ for PHP editing with HTML tags echoed out. Notepad++ had always highlighted, and interacted with the HTML, CSS, Javascript, and PHP code all in the sam

相关标签:
2条回答
  • 2021-01-19 18:35

    Thankfully, no.

    I ran into this 'problem' too. Then after an hour of trying to enable this 'feature' I realized: hey, at this point, I should be using templates anyway.

    After some consideration I've come to the conclusion that Notepad++ shouldn't do this, to encourage good coding practices.

    I'm only embarrassed that it took me so long to realize that it was no longer my editor's job to make my code readable, but mine.

    GLHF

    0 讨论(0)
  • 2021-01-19 18:39

    Looking at the screenshot, it seems your markup is all in a string that's being echoed out. In that case, Notepad++ is acting normally, highlighting the entire string as a PHP string.

    Remember that you don't need to use echo to print HTML. You can embed PHP in HTML (or HTML in PHP) by using PHP's opening and closing delimiters to break out and back in to PHP code anywhere in your files (see the manual). If you close your PHP code with ?> rather than use echo ", and open it back up at the end of the string with <?php instead of ";, your HTML should highlight as HTML again.

    0 讨论(0)
提交回复
热议问题