smarty 怎么注册类的函数(别的类和本类),并且使用! rq 谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 比如我把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函数 额 smarty没人用吗 $tpl->register_function("user_manager", "user_manager");注册函数 怎么调用别的类的函数 和本类的函数 register_function这个函数貌似在smarty3下已经别的不可用的 有什么好的方法调用函数吗 smarty是分离了HTML和代码,但是怎么使用代码郁闷死 不明白你的意思你在php这边执行好了 把要显示的assign一下 为啥非要在tpl那边执行呢 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 '失败'; }} 晕了 我用了PHPLIB TEAMPLATE模板的方法 所以出错了 谢谢 读取数据中的代码,结果被执行了。 求助新浪树形论坛的数据库设计 mysql 的查询嵌套问题。 file_get_contents的奇怪问题 多重循环下如何防止变量超过数组索引 这个格式的时间怎么转化啊,帮帮忙。 print_r 和 echo 输出正则匹配后的问题 急!!function中对数组的修改无效!! 在一行语句里调用一个类的多个方法,该怎么写? PHP 查询WSDL的 数据啊? 请教各位 $HTTP_RAW_POST_DATA的涵义是什么,最常用在什么场合? 如何创建类:输入一个华氏温度,输出摄氏温度,公式为:c=5(F-32)/9
比如我把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函数
有什么好的方法调用函数吗 smarty是分离了HTML和代码,但是怎么使用代码郁闷死
你在php这边执行好了 把要显示的assign一下 为啥非要在tpl那边执行呢
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 '失败';
}
}
晕了 我用了PHPLIB TEAMPLATE模板的方法 所以出错了 谢谢