How do I check if file exists in Smarty 2? I mean something like this:
{assign var="module_js" value="/js/modules/{$module}.js"}
{if file_exists($module_js)}
<script type="text/javascript" src="{$module_js}"></script>
{/if}
How do I check if file exists in Smarty 2? I mean something like this:
{assign var="module_js" value="/js/modules/{$module}.js"}
{if file_exists($module_js)}
<script type="text/javascript" src="{$module_js}"></script>
{/if}
Actually this has nothing to do with the Smarty-version. But the way you are assigning the variable is wrong. Try this way:
{assign var="module_js" value="js/`$module`.js"}
{if file_exists($module_js)}
<script type="text/javascript" src="{$module_js}"></script>
{/if}