Home Download Buy Blog Forum Support

PHP syntax highlighting broken with CSS

PHP syntax highlighting broken with CSS

Postby conjur3r on Sun Aug 05, 2012 7:30 am

Hi - I'm a new Mac user and am trying to find my Notepad++ alternative. Sublime looks and works just as well as Notepad++ except for one very strange behaviour. When I add embedded CSS into one of my PHP files and not complete the CSS statements, I result with something like that found in the following image.

Image

If the image doesn't work, please check out http://tinypic.com/r/jqght3/6

The colour syntax fixes itself if you add the closing bracket next to "body {". Unfortunately, I need to use PHP within some of those CSS rules (eg output custom colours/widths...). To replicate, here's the same code:

Code: Select all
<?php

   // this is some PHP comment
   if ( true )
      phpinfo();
   else
      echo 'awesome'

?>
<style type="text/css">
body {

<?php
   
class test
{
   function __construct()
   {
      if ( true )
         phpinfo();
   }
}
?>

} // end body
</style>
<?php
   if ( true )
      phpinfo();
?>


I am using Sublime Text 2.0.1 on Mountain Lion. Any thoughts/suggestions are warmly appreciated. Thanks!

Btw, been trying some of the other main editors and none of the others had the same syntax highlighting issue.
conjur3r
 
Posts: 1
Joined: Sun Aug 05, 2012 7:22 am

Re: PHP syntax highlighting broken with CSS

Postby agibsonsw on Sun Aug 05, 2012 11:51 am

The comment

// end body

is incorrect at that location. But I agree that php code within css is not recognised.

Image 1.png
Image 1.png (13.39 KiB) Viewed 773 times
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot] and 25 guests