Does anyone know how to get PHPStorm to recognize PHP inside the “==” tags?
Seems like it’s not got the highest priority (opened 9 years ago) by PhpStorm themselves:
https://youtrack.jetbrains.com/issue/WI-27668/Support-for-partial-PHP-syntax-highlighting-in-a-file
I looked and couldn’t find any octobercms plugins for PHPStorm either… Strange as it’s such a popular framework and coding in PHP inside the template functions is painful (no syntax highlighting/autoformatting):
Only other (sucky) way I can think around it is to include external php file within the template function (?)
1 Like
Unfortunately, there’s no good way. use VSCode for this very reason with this extension: OctoberCode - VS Code extension
1 Like
Oof that’s a shame (see Maarten’s last comment on the youtrack thread above, he’s absolutely right). Would be amazing if the OctoberCode author (@ksv
) can do one for PhpStorm 
1 Like
There’s really nothing special about it, except I think JetBrains only supports hard-coded hybrid templating, such as HTML, CSS, and JavaScript in the same file.
They don’t appear to offer the ability for user-land combinations, which would be:
HTML + PHP + Twig = .htm extension
These syntaxes don’t conflict, so it is reasonable and easy to do with most editors. The INI syntax with == divider is just a bonus.
Perhaps there is some technical limitation within JetBrains codebase which prevents this?
To clarify, this is all that is needed
<?
function thisIsPhpFunction() { /* syntax */ }
?>
<html>
<body>
{% if true %}
<p>This is {{ twig }} syntax</p>
{% endif %}
<script>
function thisIsJavaScriptFunction() { /* syntax */ }
</script>
<style>
body.this-is-css { background: orange; }
</style>
</body>
</html>
3 Likes