简体   繁体   English

HTML / PHP语法突出显示的错误

[英]Bug with HTML/PHP syntax highlighting

I'm using PHPStorm 6.0.3. 我正在使用PHPStorm 6.0.3。 Max for 6.x. 最多6.x。

There's a random bug with syntax highlighting when PHP is inside HTML: 当PHP位于HTML内时,语法突出显示了一个随机错误:

在此处输入图片说明

On some lines it works, on some it doesn't... 在某些方面它行得通,在某些方面却行不通...

Text code for Copy/Paste: 复制/粘贴的文本代码:

        <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135"
             alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
    </a>
<?php if ($is_packs) { ?>
    <div class="pictos">
        <?php
          if ($_product->getAttributeText('heure_conso'))
            echo '<div class="heure-conso">'.$_product->getAttributeText('heure_conso').'</div>';
          if ($_product->getAttributeText('pack_spec'))
            echo '<div class="pack_spec">'.$_product->getAttributeText('pack_spec').'</div>';
          echo '<div class="nb-plats">'.$_product->getAttributeText('pack_spec').'</div>';
          if (Mage::helper('tbm/data')->productIsOkForCustomerPhase($_product))
            echo '<div class="phase-ok">'.$this->__('Adapté à votre phase').'</div>';
        ?>
    </div>
    <div class="description">
        <?php echo $_product->getShortDescription() ?>
    </div>
<?php } ?>

Any idea ? 任何想法 ?

Not a bug -- it's your custom settings. 不是错误-这是您的自定义设置。

For whatever reason / somehow (does not actually matter) you have injected custom language (most likely HTML) into all DIV tags (the light green background). 无论出于何种原因(实际上并不重要),您都已将自定义语言(很可能是HTML)注入到所有DIV标签(浅绿色背景)中。 Now everything in such tags is forcibly treated as that language (HTML?) -- PHP is ignored completely. 现在,此类标记中的所有内容都被强制视为该语言(HTML?)-PHP被完全忽略。

Settings (Preferences on Mac) | Language Injections Settings (Preferences on Mac) | Language Injections -- find and delete offending rule. Settings (Preferences on Mac) | Language Injections -查找和删除违规规则。 It should have "project" or "global" in most right column (Scope) -- do not touch "bundled" ones. 它在最右边的列(范围)中应具有“项目”或“全局”-请勿触摸“捆绑式”项目。

Alternatively -- Alt + Enter while having caret inside problematic place and choose "Uninject xxx" from popup menu. 或者-在有问题的地方插入尖号时, 按Alt + Enter ,然后从弹出菜单中选择“取消注入xxx”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM