完成博客的不分页面

This commit is contained in:
augushong
2020-04-24 13:04:56 +08:00
parent d07fd05f65
commit 3a36960c9c
8 changed files with 560 additions and 0 deletions

View File

@@ -43,6 +43,11 @@ class System extends Common
return View::fetch();
}
public function blog()
{
return View::fetch();
}
public function update()
{

12
app/common/TextFormat.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace app\common;
class TextFormat
{
public static function br($content){
$content = str_replace("\n",'<br/>',$content);
return $content;
}
}

View File

@@ -22,6 +22,29 @@ class Index extends Common
return $this->fetch();
}
public function __blogIndex()
{
$list_category = Category::select();
$this->assign('list_category',$list_category);
$category_id = $this->request->param('category_id');
if(!empty($category_id)){
$model_list_post = Post::hasWhere('categorys',['category_id'=>$category_id])->order('sort desc');
}else{
$model_list_post = Post::order('sort desc');
}
$list_post = $model_list_post->paginate();
$this->assign('list_post',$list_post);
}
public function __documentsIndex()
{
$list_index_documents_nav = Nav::where('type',9)->select();