smarty中的几个常用函数 templateExists() fetch() include

悠悠 2022-07-17 04:22 277阅读 0赞

templateExists()

$smarty->templateExists();

  1. <?php
  2. // 设置文件名,如 index.inc.tpl
  3. $mid_template = $_GET['page'].'.inc.tpl';
  4. if( !$smarty->templateExists($mid_template) ){
  5. $mid_template = 'page_not_found.tpl';
  6. }
  7. $smarty->assign('content_template', $mid_template);
  8. $smarty->display('page_container.tpl');
  9. ?>

发表评论

表情:
评论列表 (有 0 条评论,277人围观)

还没有评论,来说两句吧...

相关阅读

    相关 #include 函数

    accumlate : iterator 对标志的序列中的元素之和,加到一个由 init 指定的初始值上。重载的版本不再做加法,而是传进来的二元操作符被应用到元素上。 adj