基本信息
源码名称:thinkphp 简单的blog程序实例源码(含数据库脚本,onethink)
源码大小:4.92M
文件格式:.zip
开发语言:PHP
更新时间:2016-02-18
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
对于基础很好 ,含数据库脚本文件
<?php // ---------------------------------------------------------------------- // | OneThink [ WE CAN DO IT JUST THINK IT ] // ---------------------------------------------------------------------- // | Copyright (c) 2013 http://www.onethink.cn All rights reserved. // ---------------------------------------------------------------------- // | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn> // ---------------------------------------------------------------------- namespace Home\Controller; /** * 文档模型控制器 * 文档模型列表和详情 */ class ArticleController extends HomeController { /* 文档模型频道页 */ public function index(){ /* 分类信息 */ $category = $this->category(); //频道页只显示模板,默认不读取任何内容 //内容可以通过模板标签自行定制 /* 模板赋值并渲染模板 */ $this->assign('category', $category); $this->display($category['template_index']); } /* 文档模型列表页 */ public function lists($p = 1){ /* 分类信息 */ $category = $this->category(); $cate = M('Category')->getByName(I('category')); $this->assign('cate', $cate); /* 获取当前分类列表 */ $Document = D('Document'); $list = $Document->page($p, $category['list_row'])->lists($category['id']); if(false === $list){ $this->error('获取列表数据失败!'); } /* 模板赋值并渲染模板 */ $this->assign('category', $category); $this->assign('list', $list); $this->display($category['template_lists']); } /* 文档模型详情页 */ public function detail($id = 0, $p = 1){ /* 标识正确性检测 */ if(!($id && is_numeric($id))){ $this->error('文档ID错误!'); } /* 页码检测 */ $p = intval($p); $p = empty($p) ? 1 : $p; /* 获取详细信息 */ $Document = D('Document'); $info = $Document->detail($id); if(!$info){ $this->error($Document->getError()); } /* 分类信息 */ $category = $this->category(); /* 获取模板 */ if(!empty($info['template'])){//已定制模板 $tmpl = $info['template']; } elseif (!empty($category['template_detail'])){ //分类已定制模板 $tmpl = $category['template_detail']; } else { //使用默认模板 $tmpl = 'Article/'. get_document_model($info['model_id'],'name') .'/detail'; } /* 更新浏览数 */ $map = array('id' => $id); $Document->where($map)->setInc('view'); /* 模板赋值并渲染模板 */ $this->assign('category', $category); $this->assign('info', $info); $this->assign('page', $p); //页码 $this->display($tmpl); } }