有2个模板文件a.tpl和b.tpl其中a.tpl里有{$aaa}标签
b.tpl为随意内容
<?php
$smarty = new Smarty;
$smarty->compile_check = true;
$smarty->assign('aaa','这里加入b.tpl的内容');
$smarty->display('a.tpl');
?>
这样怎么弄?

解决方案 »

  1.   

    在a.tpl里include b.tpl不就行了,这样传值没有试过.
      

  2.   

    因为
    $smarty->assign('aaa','这里加入b.tpl的内容');
    是动态的
    所以要在程序里加
      

  3.   

    $abc="你好";$smarty->assign("names",$abc);
    $con=$smarty->fetch("test.tpl",null,null,false);$smarty->assign('aaa','这里加入'.$con.'的内容');
    $smarty->display('a.tpl');这样就可以了!
      

  4.   

    为什么不在a.tpl里用include 呢?