Below is the code I need to generate. You can see that the last image can`t have a comma after it, otherwise it won`t validate.
Code: Select all
$.preloadImages("image1.jpg", image2.jpg","image3.jpg");Code: Select all
$.preloadImages("image1.jpg", image2.jpg","image3.jpg");Code: Select all
{strip}
$.preloadImages(
{foreach from=$whatever item="item" name="myloop"}
"{$item->variable}"
{if !$smarty.foreach.myloop.last},{/if}
{/foreach}
{/strip}
);Code: Select all
{strip}
$.preloadImages(
{assign var="isfirst" value=1}
{foreach from=$whatever item="item"}
{if $isfirst}{assign var="isfirst" value=0}{else},{/if}
"{$item->variable}"
{/foreach}
{/strip}
);Code: Select all
{strip}
$.preloadImages(
{foreach from=$whatever item="item" key="key"}
{if $key>0},{/if}
"{$item->variable}"
{/foreach}
{/strip}
);