phpprestashopsmartyprestashop-1.6w3c-validation

Smarty generate script tag with empty src


i am using PrestaShop e-commerce electromarket theme

this is smarty code that generate js header file

   {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
    {$js_def}
    {foreach from=$js_files item=js_uri}
    <script type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}"></script>
    {/foreach}
{/if}    

but in rendered HTML it generate script tag without any src

<script type="text/javascript" src="" ></script>

When I use w3 validator it gives me the error:

w3 validator  error

How can I solve this problem?


Solution

  • You must add another condition

    {if isset($js_defer) && !$js_defer && isset($js_files) && isset($js_def)}
       {$js_def}
       {foreach from=$js_files item=js_uri}
           {if $js_uri}
               <script type="text/javascript" src="{$js_uri|escape:'html':'UTF-8'}"></script>
           {/if}
       {/foreach}
    {/if}