Question

When implementing code like i.e.

<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html> 

http://i.stack.imgur.com/DleAX.gif

Next to <?php it gives red X icon with error that "<" missing '>' for end of tag. I did find some older threads about this here at stackoverflow, but there wasn't really any solution or response at all. I tried the solution of adding PHP Source Editor for .html and setting it as default, but looks like it doesn't work.

It's not a deal breaker, it's just I don't like red icons and false errors throughout the code.

Was it helpful?

Solution 2

The title of your question suggests that you are saving the files as .html

If this is the case then there will be an error as Aptana will not be looking to validate <?php ?> tags. If I'm right then you will need to save the files as filename.php and not filename.html.

If this is not the case then you might want to change the title slightly.

OTHER TIPS

This is because .html files are opened with HTML editor, not PHP.

You can try to right-click on your file, then select "Open With" -> "Other ..." -> "PHP Source Editor".

The tag is legit html. The file he's editing is html. The stock html editor does not flag this as an error. Sorry - I just joined and I can't "comment" yet - but my answer would be...

This looks like a bug in the Aptana HTML editor.

I see this on occasion. If you're editing OPC (Other People's Code), especially WordPress code, sometimes an IF statement will be opened in one PHP file and closed in another. This is often seen in "the Loop" and is the way it's built.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top