Smarty

JavaScript?

  • {literal}
    <script language="javascript">
    </script>
    {/literal}

  • [$hoge|escape|lnl2br}

  • <?php
    require_once('Smarty.php');
    
    // smarty
    $smarty = new Smarty();
    
    $smarty->template_dir = "./templates/";
    $smarty->compile_dir = "./templates_c/";
    $smarty->config_dir = "./configs/";
    $smarty->cache_dir = "./cache/";
    
    $smarty->caching = true;
    
    $smarty->cache_lifetime = 600;	// 10分
    
    $smarty->compile_check  = false;
    
    
    if (!$smarty->is_cached("template.tpl")) {
    
    }
    
    
    $smarty->display("template.tpl");
    ?>
  • <?php
    require_once('Smarty.php');
    
    // smarty
    $smarty = new Smarty();
    
    $smarty->template_dir = "./templates/";
    $smarty->compile_dir = "./templates_c/";
    $smarty->config_dir = "./configs/";
    $smarty->cache_dir = "./cache/";
    
    $smarty->caching = true;
    
    $smarty->cache_lifetime = 600;	// 10分
    
    $smarty->compile_check  = false;
    
    
    userid = session_id();
    
    
    
    
    }
    
    
    
    ?>

foreach

  • {foreach from=$items item=i name=items}
      {$smarty.foreach.items.index}
    {/foreach}

for-next

{section name="page" loop=10}
{$smarty.section.page.index+1}<br>
{/section}

{if ($arr|@count) < 5}
hoge
{else}
fuga
{/if}


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: Tue, 12 Oct 2021 01:05:38 JST (925d)