rq 谢谢

解决方案 »

  1.   


    比如我把smarty写在
    class bll
    {
       function index()
      {
        $tpl->template_dir = array("template/index/","template/login/");
        $tpl->compile_dir = "libs/templates_c/";
        $tpl->config_dir = "libs/configs/";
        $tpl->cache_dir = "libs/cache/";
        $tpl->left_delimiter = "<{"; 
        $tpl->right_delimiter = "}>";
        $tpl->parse('reg',"reg.html");//自己加的1个函数,功能是加载页面
        $tpl->display(index.tpl); //index.tpl//reg在index里出现
       }
       function user_manager()
       {
          //这个地方对数据库的操作 
          if() return '成功';   else return '失败';
       }
    }怎么用user_manager函数
      

  2.   

     额  smarty没人用吗 $tpl->register_function("user_manager", "user_manager");注册函数 怎么调用别的类的函数 和本类的函数
      

  3.   

    register_function这个函数貌似在smarty3下已经别的不可用的
      

  4.   


    有什么好的方法调用函数吗    smarty是分离了HTML和代码,但是怎么使用代码郁闷死 
      

  5.   

    不明白你的意思
    你在php这边执行好了 把要显示的assign一下  为啥非要在tpl那边执行呢
      

  6.   


    class bll
    {
      function index()
      {
      $tpl->template_dir = array("template/index/","template/login/");
      $tpl->compile_dir = "libs/templates_c/";
      $tpl->config_dir = "libs/configs/";
      $tpl->cache_dir = "libs/cache/";
      $tpl->left_delimiter = "<{";  
      $tpl->right_delimiter = "}>";
      $tpl->assign('echo',self::user_manager());/////这样吗?
      $tpl->parse('reg',"reg.html");//自己加的1个函数,功能是加载页面
      $tpl->display(index.tpl); //index.tpl//reg在index里出现
      }
      function user_manager()
      {
      //这个地方对数据库的操作  
      if() return '成功'; else return '失败';
      }
    }
      

  7.   


    晕了  我用了PHPLIB TEAMPLATE模板的方法 所以出错了 谢谢