简体   繁体   中英

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 give me error:
w3 validator error
what is wrong and how can i solve this problem?

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}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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