为什么你们不喜欢查官方手册,例子又多又典型http://smarty.php.net/manual/en/language.function.section.php

解决方案 »

  1.   

    二楼的搞错了吧?fetch是啥玩意,和嵌套有关吗?
      

  2.   

    {include file="header.tpl"}{* body of template goes here *}{include file="footer.tpl"}
      

  3.   

    load_nav.php
    -------------<?php // load in variables from a mysql db and assign them to the template
    require_once("MySQL.class.php");
    $sql = new MySQL;
    $sql->query("select * from site_nav_sections order by name",SQL_ALL);
    $this->assign('sections',$sql->record);?>
    index.tpl
    ---------{* absolute path, or relative to $trusted_dir *}
    {include_php file="/path/to/load_nav.php"}{foreach item="curr_section" from=$sections}
    <a href="{$curr_section.url}">{$curr_section.name}</a><br>
    {/foreach}
      

  4.   

    index.php
    $smarty->display( index.tpl);index.tpl
    在tpl里是html语言写的你想写的东东
      

  5.   

    类似PHP lib的用法把分析后的模板代码赋给一个{$handle}你们说的好象不是我想要的
      

  6.   

    一样在手册里:
    http://smarty.php.net/manual/en/api.fetch.php
      

  7.   

    不过不知道你需要什么效果,smarty里可能有更方便的方法
      

  8.   

    sqlite_list.htm[子模版]
    sqlite.htm[主模版]
    $tpl->assign("major",$major);
    $vard = $tpl->fetch("sqlite_list.htm");
    $tpl->assign("major",$vard);
    $tpl->display("sqlite.htm");
    就OK!
      

  9.   

    smarty 实现嵌套了吗? 奇怪