Best way to set up PhpStorm to gracefully handle unsupported template system?

At work our website is run using some off the shelf shopping cart software which uses its own templating system which tends to cause a few minor annoyances.

Idealy I would create my own plugin to handle the template system, however I'm not quite sure if its somehting I would beable to do (or how to go about it), so I was wondering if there are any settings I could change to make PhpStorm treating the template system elements like HTML tags and stop the inspector tring to resovle template variables as files in href and src attributes.

Template files all have the extension .html and can contain a mix of HTML,PHP and the template language which is used in the following ways:

<#if:product.image:neq:blank#> <img src="{product.image}" alt="{product.name}" title="{product.name}"/> <#else#> No Image <#/if#>

Basically it uses <# #> and <#/ #> for control structures and functions such as <#include:includes/breadcrumb.html#> and uses {} to denote a variable.

3 comments
Comment actions Permalink

Hi Mark,

Not sure if this be good enough, but try this:

  • open such file in PhpStorm
  • in status bar, right hand side, locate icon of man in a hat and click on it (or just Code | Configure Current File Analysis... Ctrl+Alt+Shift+H)
  • in pop up window move slider for HTML from "Inspections" to "Syntax" or maybe even "None" -- this should disable additional checks.

This needs to be done on per file level.

Alternatively you can disable all unnecessary Inspections altogether in File | Settings | Inspections -- create custom profile there and switch between them if such additional checks are required.

    0
    Comment actions Permalink

    any ideas on maybe being able to create a template thing for this case? my templating engine uses a django style syntax - so similer boat.

    is it possible to for instance use an html doc and say you use xyz as your template tags..

    0
    Comment actions Permalink

    As far as I know -- No -- it has to be implemented properly via separate plugin for every templating language/syntax (unless someone someday will implement universal plugin (with some limited functionality) that will handle such user defined tags/rules... which would be pretty hard task considering different possible approaches used by your custom templating system) otherwise we would not have those tickets for additional templating systems.

    0

    Please sign in to leave a comment.