Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 394928

Summary: [codemirror] Assume all PHP files can contain HTML
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: ClientAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: mike.milinkovich
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2012-11-22 13:34:13 EST
PHP code is generally written with either the .php or .phtml extension. Currently these are treated as 2 different filetypes by the CodeMirror plugin: .phtml highlights HTML and .php does not. 

This is an artificial distinction since PHP parses them both the same way. Should investigate merging those 2 file types into a single one, which can contain mixed PHP+HTML.
Comment 1 Mike Milinkovich CLA 2012-11-23 13:24:06 EST
I have tried renaming a couple of my .php files to .phtml and Orion 1.0 does not provide any syntax highlighting of the HTML. It's only highlighting the PHP code. In other words, it seems like the CodeMirror plug-in is actually treating .phtml files exactly the same as .php files.

[1] is the file I was trying. If you want to try repeating my attempt, it is contained in the [2]repo.

[1] http://www.eclipse.org/org/foundation/directions_Portland.php
[2] git.eclipse.org/gitroot/www.eclipse.org/org.git
Comment 2 Mark Macdonald CLA 2012-11-27 17:18:56 EST
OK, I see the problem. The HTML code in question is inside a heredoc string:
> <?php 
>   $html = <<<EOHTML
> 	<div id="midcolumn">
>            <!-- lots of html -->
> 	</div>
> EOHTML;
> 
> ?>

The "EOHTML" delimiter is a convention indicating the heredoc contains HTML. Some editors recognize this and provide HTML highlighting, but CodeMirror currently does not. It only highlights HTML code outside of your <?php .. ?> tags (and, in the case of Orion, only within a .phtml file, as I mentioned earlier).

If anyone wants to add support for EOHTML to CodeMirror's PHP parser [1], we can pick it up in the next plugin update. 

[1] https://github.com/marijnh/CodeMirror/blob/master/mode/php/php.js
Comment 3 John Arthorne CLA 2015-05-05 15:50:38 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html
Comment 4 John Arthorne CLA 2015-05-05 16:03:10 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:


https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html