Skip to content Skip to sidebar Skip to footer

Is There Anyway To Have Notepad++ Highlight Both Php And Html At The Same Time?

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 same docume

Solution 1:

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.

Solution 2:

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

Post a Comment for "Is There Anyway To Have Notepad++ Highlight Both Php And Html At The Same Time?"