I was just wondering if anyone had a text editor that could be configured to highlight both css and php in the same document.

Comments

danmasq’s picture

In jEdit, I normally work with dcss in css highlight mode. I don't think I've ever come across a multi-language highlighter. I imagine that it would be complicated to implement.

If you're writing enough php in your css that you need syntax highlighting for your php, you might need to create a yourfile.dcss.inc file with your extended length php methods. This way you could write a method:

function myFunction() {
  ... 
  return $stuff;
}

and in your .css.php files, myFunction() will be globally available.

#my-css-element {
  <?php print myFunction(); ?>
}

Place your *.dcss.inc file in your theme's root directory (e.g. adjacent to a template.php).

As a rule of thumb, you might want to keep the php in your css.php to little 1-liners so you can stay in css highlight mode.

Hope this will help your highlighting woes.

colemanw’s picture

Thanks, I'm not too woeful about it, just thought I would ask. If there was such an editor, I wouldn't want to be the last kid on the block to have it.

I had the idea that it was possible based on php highlighting, which is multi-language if you think about it. Based on the presence of <?php ?> tags, the text editor intelligently switches between html and php syntax.