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模板的方法 所以出错了 谢谢 为什么active user: <?php echo $_SESSION["username"];?>都不显示 html中如何使用php的变量 mysql_fetch_object问题 json文件里的数据能指定更新<更改>吗? 小妹有一个问题请教,把数据库中的数据以PDF文件的形式导出?急 页面加载顺序的问题~ 有点狐疑,靠做一些网站,能赚钱吗? PHP验证和检查 对php版的faq分类的想法 文件读写 请教各位 $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模板的方法 所以出错了 谢谢