1.演示网站已删除
2.数据库使用的laobingcms数据库,想开发织梦的就用织梦的数据库
3.代码可以参考资源里面的
4.自定义标签的创建,调用
5.前台模板的解析
6.模板分为栏目,文章,列表三种
7.其他的模板可以自定义创建:如留言模板
8.栏目的标签第一种:
public function tagPage($tag,$content) { $result= !empty($tag['result'])?$tag['result']: 'page'; $map.=($tag['sqlstr'])?" {$tag['sqlstr']} ":"1=1"; $sql ="db('{$tag['table']}')->"; $sql.="where(\"{$map}\")->"; $sql.=($tag['field'])?"field('{$tag['field']}')->":""; $sql.=($tag['order'])?"order('{$tag['order']}')->":""; if(empty($tag['num'])){ $tag['num'] = 20; } $sql.=($tag['num'])?"limit((input('param.p',1,'intval')-1)*{$tag['num']},{$tag['num']})->":""; // $sql.=($tag['cache'])?"cache(true,{$tag['cache']})->":""; $sql.="select()->toArray()"; $parsestr = '<?php $_result='.$sql.';'; $parsestr .= "\$count=db('{$tag['table']}')->where(\"{$map}\")->count();"; $parsestr .= '$Page=new \org\Page($count,'.$tag['num'].',["c_id"=>input("param.c_id")]);'; $parsestr .= '$showpage=$Page->show();'; $parsestr .= 'foreach($_result as $key=>$'.$result.'):?>'; $url = "U(\$coulnmulist['c_id'])"; $parsestr .= '<?php $'.$result.'["url"]='.$url.'; ?>'; $parsestr .= $content;//解析在article标签中的内容 $parsestr .= '<?php endforeach?>'; // dump($parsestr);exit; return $parsestr; }
第二种
//栏目查询标签 public function tagColumnlist($tag,$content) { $result= !empty($tag['coulnmulist'])?$tag['coulnmulist']: 'coulnmulist'; $map.=($tag['columnid'])?" {$tag['columnid']} ":"1"; $sql ="db('column')->"; $sql.=($tag['field'])?"field('c_id,c_path,c_name,{$tag['field']}')->":"field('c_id,c_path,c_name')->"; $sql.="where(\"{$map}\")->"; $sql.=($tag['order'])?"order('{$tag['order']}')->":"order('c_order asc')->"; $sql.=($tag['num'])?"limit({$tag['num']})->":""; $sql.="select()->toArray()"; $empty =isset($tag['empty'])?$tag['empty']:''; //下面拼接输出语句 $parsestr = '<?php $_result=htmlOutList('.$sql.',false);'; $parsestr .= 'if($_result)'; $parsestr .= 'foreach($_result as $key=>$'.$result.'):?>'; $url = "U(\$coulnmulist['c_id'])"; $subdata = "db('column')->where('c_parentid',\$coulnmulist['c_id'])->count()"; $parsestr .= '<?php $'.$result.'["url"]='.$url.';$'.$result.'["subdata"]='.$subdata.'; ?>'; $parsestr .= $content;//解析在article标签中的内容 $parsestr .= '<?php endforeach;else?>'; $parsestr .='<?php echo "'.$empty.'";?>'; // dump($parsestr);exit; return $parsestr; }