php文章管理模块实例代码供参考

上传人:m**** 文档编号:508404976 上传时间:2023-09-19 格式:DOC 页数:5 大小:30.50KB
返回 下载 相关 举报
php文章管理模块实例代码供参考_第1页
第1页 / 共5页
php文章管理模块实例代码供参考_第2页
第2页 / 共5页
php文章管理模块实例代码供参考_第3页
第3页 / 共5页
php文章管理模块实例代码供参考_第4页
第4页 / 共5页
php文章管理模块实例代码供参考_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《php文章管理模块实例代码供参考》由会员分享,可在线阅读,更多相关《php文章管理模块实例代码供参考(5页珍藏版)》请在金锄头文库上搜索。

1、php文章管理模块实例代码php写的文章管理模块,包括添加文章、修改与删除文章、查看文章列表等,有需要的朋友,可以作个参考。代码如下,实现了文章管理的基本功能,大家注意看注释,知识点还是不少的。BasePath = ./FCKeditor/; / 设置FCKeditor目录地址 /*action操作初始化*/ if(emptyempty($_REQUESTaction) $_REQUESTaction=list; else $_REQUESTaction=trim($_REQUESTaction); if($_REQUESTaction=add) $oFCKeditor = new FCKed

2、itor(content) ; / 创建FCKeditor实例,可创建多个实例 $oFCKeditor-BasePath = ./FCKeditor/; / 设置FCKeditor目录地址 $tpl-assign(fck,$oFCKeditor-Create(); $tpl-assign(tmess,添加文章); $tpl-assign(act,insert); $tpl-assign(submitButton,添加); $tpl-display(admin/addArticle.tpl); /*添加文章*/ elseif ($_REQUESTaction=insert) $title=$_P

3、OSTtitle; $zhaiyao=$_POSTzhaiyao; $author=$_POSTauthor; $laiyuan=$_POSTlaiyuan; $keyword=$_POSTkeyword; $is_tuijian=$_POSTis_tuijian; $content=$_POSTcontent; $sql=insert into article (title,zhaiyao,author,laiyuan,keyword,is_tuijian,content,addtime) values ($title,$zhaiyao,$author,$laiyuan,$keyword,$

4、is_tuijian,$content,now(); $rs=$db-query($sql); if($rs) echo header(location:/admin/article.php?action=list); else echo 失败!; /*文章列表*/ elseif ($_REQUESTaction=list) $total=getAllArticle(); $curpage=isset()($_GETpage)?$_GETpage:1; $pageObj=new Page($total,$curpage); $pageInfo=$pageObj-getPageInfo(); $

5、arts=getArticlePage($pageInforow_offset,$pageInforow_num); $tpl-assign(tmess,文章列表); $tpl-assign(arts,$arts); $tpl-assign(pageInfo,$pageInfo); $tpl-display(admin/editArticle.tpl); /*修改文章*/ elseif ($_REQUESTaction=edit) $id=$_GETid; $post=editArticle($id); $tpl-assign(tmess,修改文章); $tpl-assign(post,$po

6、st); $oFCKeditor-Value=$postcontent; /编辑时显示文章内容 if($postis_tuijian=1|$_POSTrecommend=1) /判断是否推荐 $tpl-assign(recommend,checked); else $tpl-assign(no_recommend,checked); $tpl-assign(fck,$oFCKeditor-Create(); $tpl-assign(act,update); $tpl-assign(submitButton,修改); $tpl-display(admin/addArticle.tpl); els

7、eif ($_REQUESTaction=update) $id=$_POSTid; $title=$_POSTtitle; $zhaiyao=$_POSTzhaiyao; $author=$_POSTauthor; $laiyuan=$_POSTlaiyuan; $keyword=$_POSTkeyword; $is_tuijian=$_POSTis_tuijian; $content=$_POSTcontent; $sql=update article set title=$title,zhaiyao=$zhaiyao,author=$author,laiyuan=$laiyuan,key

8、word=$keyword,is_tuijian=$is_tuijian, content=$content where id =$id; $rs=$db-query($sql); if($rs) echo header(location:/admin/article.php?action=list); else echo 修改失败!; /*删除*/ elseif ($_REQUESTaction=del) $id=$_GETid; del($id); /*审核文章*/ elseif ($_REQUESTaction=shenhe) $id=$_GETid; shenhe($id); /*锁定

9、文章*/ elseif ($_REQUESTaction=lock) $id=$_GETid; lock($id); /*批量删除*/ /*批量审核*/ elseif (isset($_REQUESTshenhe_x)|isset($_REQUESTshenhe_y) $del=$_POSTdel; shenhe($del); /*批量锁定*/ elseif (isset($_REQUESTlock_x)|isset($_REQUESTlock_y) $del=$_POSTdel; lock($del); /*=-文章模块相关函数=*/ /* * 获取所有的文章进行分页用 * */ function getAllArticle() global $db; $sql=select * from article; $rs=$db-query($sql); $total=$db-num_rows($rs); return $total; /*文章分页相关函数*/ function getArticlePage($offset,$num) global $db; $sql=sele

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 资格认证/考试 > 自考

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号