level e member's product commend list
public function product_comm($size = 5){
$pre = $size <> 5 && !empty($_request['lb']) ? " and prolb like '%".$_request['lb']."%' " : "";
$this->where = " judge_flag = 0 and pubname = '".$_request['user']."' $pre ";
$sql = " select id, pingpai, img, huohao from user_proinfo where ".$this->where.
" order by pubtime desc ";
$res = $this->selectrs->selectlimit($sql, $size, ($this->page - 1) * $size );
$this->navipage_cm("`user_proinfo`", $size, $this->where);
return $res;
}
// embed in all must be used cat page function
private function navipage_cm($table, $size, $where){
$count = $this->selectrs->getone("select count(*) from $table where $where ");
$pages = @ceil($count/$size);
for ($i = 0; $i <= $pages; $i++) $arr[] = $i;
$navi_cm = array( "option" => $arr,
"page" => $this->page,
"pages" => $pages,
"count" => $count, 字串7
"size" => $size,
"param" => $this->param
);
$this->tpl->assign("navi_cm", $navi_cm);
}
smarty代码
关于smarty模板分析
基本语法
所有的smarty标签都被加上了定界符.在smarty里,所有定界符以外的内容都是静态的,当smarty遇到了模板标签,将尝试解释他们,然后再以恰当的方式输出.
默认情况下是 {和},但它们是可定制的.定制方法是:
$smarty->left_delimiter = '';
1.注释
模板注释被*号包围,例如 {* this is a comment *}
smarty注释将不被输出.它是模板内在的注释.
2.变量
模板变量以$开头,可以包含数字,字母和下划线。
config_file变量是例外要用#变量名#的方法引用
3.函数
smarty标签输出一个变量或者调用某种函数.
在定界符内函数和其属性将被处理和输出.例如:
{funcname attr1="val" attr2="val"}.
funcname为函数的名称比如:include等,attr1,attr2为属性名,val为属性相应的值。
在模板里无论是内建函数还是自定义函数都有相同的语法.
内建函数将在smarty内部工作,例如 {if}, {section} 和{strip}.他们不能被修改.