文章分类页模板(category.blade.php)
1、引入公共文件
@include("template::mycms.views._header")
@include("template::mycms.views._footer")
2、文章列表
读取本分类下的文章(系统已自动识别当前页面类型和分类ID,所以不需要填入相关参数)
$page : 为页面变量,自动读取
12 : 为读取文章数量
articles($page,12)
示例使用
@foreach($articles = articles($page,12) as $article)
<div class="blog-box wow fadeInUp">
@if(isset($article->img))
<a href="{{single_path($article->id)}}" class="blog-pic">
<img src="{{$article->img}}" alt="{{$article->title}}"
style="max-height: 220px;max-width: 340px">
</a>
@endif
<div class="blog-desc">
<div class="blog-meta">
<ul>
<li>
<i><img src="/mycms/cms/theme/mycms/assets/img/icons/check-list.png"></i>
<span>{{created_at_date($article->created_at)}}</span>
</li>
<li>
<span><a
href="{{category_path($article->category->id)}}">{{$article->category->name}}</a></span>
</li>
</ul>
</div>
<a href="{{single_path($article->id)}}">
<h5 class="work-title">
{{$article->title}}
</h5>
</a>
<p>
{{$article->description}}
</p>
<div class="work-btn">
<a href="{{single_path($article->id)}}" class="btn-2">阅读更多
<i>
<img src="/mycms/cms/theme/mycms/assets/img/icons/long-arrow.png">
</i>
</a>
</div>
</div>
</div>
@endforeach
3、列表分页
根据自定义的分页模板来显示分页按钮
{{ $articles->links('template::mycms.views._page') }}