6 Replies Last post: May 2, 2014 3:40 AM by Logan Etherton  
Logan Etherton Newbie 4 posts since
May 1, 2014
Currently Being Moderated

May 2, 2014 12:06 AM

PHP not recognized between DOM elements

I feel like the answer to this must be obvious, but given the frequency of the words used to describe the issue, I'm having a hard time searching for a resolution to this.

 

Basically, when I have code such as this:

 

<div class="container infinite-scroll-canvas post-index">

<?php

if ($a = 'b'):

...

endif;

?>

</div>

 

All of the PHP that is within DOM nodes isn't recognized as PHP. PHPStorm thinks that it's HTML, despite the fact that it's enclosed in PHP tags.

 

PHP within the HTML tag itself, such as this:

 

<div class="<?=$class;?>"></div>

 

works just fine. Only PHP between the opening and closing HTML tags causes a problem.

 

Any ideas?

Andriy Bazanov Master 3,911 posts since
May 28, 2010
Currently Being Moderated
May 2, 2014 1:37 AM in response to: Logan Etherton
Re: PHP not recognized between DOM elements

Hi there,

 

Please attach:

1) example file

2) scheenshot of how it looks on your computer

 

But before that -- "File | Invalidate Caches" in case if you have not done it yet.

 

BTW -- what PhpStorm version do you use exactly (Help | About) ?

Andriy Bazanov Master 3,911 posts since
May 28, 2010
Currently Being Moderated
May 2, 2014 2:34 AM in response to: Logan Etherton
Re: PHP not recognized between DOM elements

Purelly based on screenshot -- you have Custom Language injected (somehow) into one of the tags (the green backgound .. so most likely DIV).

 

Alt+Enter while caret standing there and choose "Uninject"

or

"Settings | Language Injections" and disable/delete offending one (will be of "global" or "project" type -- not "bundled")

Andriy Bazanov Master 3,911 posts since
May 28, 2010
Currently Being Moderated
May 2, 2014 3:26 AM in response to: Logan Etherton
Re: PHP not recognized between DOM elements

Settings | Code Style | JavaScript | Wrapping and Braces -- all relative options will be there

 

You will need play and adjust Function call arguments (I believe)

More Like This

  • Retrieving data ...