GNOME Bugzilla – Bug 564345
Problem with embedded PHP in a unquoted HTML attribute
Last modified: 2014-02-08 21:29:14 UTC
In a page with a .php extension (e.g. index.php), PHP is incorrectly highlighted inside HTML when there are no encompasing double-quotes. Here is case I found from work (I didn't write this, else it wouldn't look like this) where PHP is highlighted incorrectly. ---- <a href=viewcustompage.php?id=<?php print $select_custom_page["page_id"]; ?>><img src="/buttons/<?php print $buttons; ?>/view.gif" border="0" alt="View this Custom Page"></a> ---- Since this is still valid HTML 4.0 (unfortunately -- believe me, I'm a big proponent of XHTML 1.1), I wonder if the solution to this, and any other multiple-syntax-highlights-in-one-file-problems may be fixed with this idea: In an HTML file, the code uses the default background. When JavaScript, CSS and/or PHP are embedded, they use a different colour background. PHP could be light light yellow, JavaScript could be light light blue and CSS would be light light red. I think that visually separating these scripts/markups when contained in one file is very important. Hopefully this will close bugs similar to: http://bugzilla.gnome.org/show_bug.cgi?id=564173
I can confirm that this is still not correctly highlighted on the trunk version
(In reply to comment #0) > ---- > <a href=viewcustompage.php?id=<?php print $select_custom_page["page_id"]; > ?>><img src="/buttons/<?php print $buttons; ?>/view.gif" border="0" alt="View > this Custom Page"></a> > ---- To fix this problem, here is an idea: https://bugzilla.gnome.org/show_bug.cgi?id=565524#c12 About different background colors, it can be nice, indeed.
The problem with embedded PHP in unquoted attributes is fixed: https://git.gnome.org/browse/gtksourceview/commit/?id=27d3f3a58b59b281fded601a34fae5e77dc3423d > About different background colors, it can be nice, indeed. It would be simpler to open another bug report for that.
See bug #723927 for the other part of this bug.