Mulitple languages in the same file?


If I have a .phtml file (php and html) and want to be able to lint that file checking for both html and php errors… how would I go about doing that?

eg. the file is called “index.phtml”

and contains the following:

<?php if(!$getLoadedProduct->count()): ?>
    <p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>
    <div class="category-products">
        <?php echo $this->getHtml('product_list.before_toolbar'); ?>
        <?php echo $this->getToolbarHtml() ?>
        <ol class="row products-grid" id="products-grid">
            <?php $i=0; foreach ($_products as $_product): $i++; ?>
            <li class="col-lg-6 col-md-6 col-sm-6 col-xs-12 item">
                <?php echo $this->getGridItemHtml($_product); ?>
        <?php endforeach ?>
<?php endif; ?>

As you can see it contains both php and html code… would like to lint both :slight_smile:


Did you find a solution for this problem? Im having the same issues.


Do you have a command-line linter to lint that file? If so, there might be a linter-* package to run it on the file.