Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ファイルが Smarty 2 に存在するかどうかを確認するにはどうすればよいですか? 私は次のようなことを意味します:
{assign var="module_js" value="/js/modules/{$module}.js"} {if file_exists($module_js)} <script type="text/javascript" src="{$module_js}"></script> {/if}
実際、これは Smarty バージョンとは関係ありません。しかし、変数を割り当てる方法が間違っています。この方法を試してください:
{assign var="module_js" value="js/`$module`.js"} {if file_exists($module_js)} <script type="text/javascript" src="{$module_js}"></script> {/if}