大家好:
初学php smarty模板,求教如下问题
在smarty 模板中有insert 内置函数,insert用来调用其它php 脚本中的函数,
比如:{insert name="function_name" script="/path/file/name" }
但是如果这个php脚本的函数在某一个名字空间中定义的,insert 中该如何调用呢?
比如:
test1.php 内容如下:
<?php
namespace USER_space{
   user_function(){.....}
}
?>index.tpl 中要调用 user_function() 函数时
该如何写 insert 语句?

解决方案 »

  1.   


    这样写好像还是不行,insert 中的name="xxx" 会被smarty 解释成 smarty_insert_xxx
    而name="USER_space\\xxx" 则被解释成为 smarty_insert_USER_space\xxx 。我实验是这样的错误。
      

  2.   

    http://www.smarty.net/forums/viewtopic.php?p=78032参见这个帖子
    至少在2010年,smarty的template里面不支持namespace