三大标签:
<title>{$archivesData.title}-{$web_title}</title> <meta name="keywords" content="{$archivesData.keywords}" /> <meta name="description" content="{$archivesData.description}"/>
html:
<div class="article_title">{$archivesData.title}</div> <div class="article_time">来源:<a href="/">TP课堂</a> 时间:{$archivesData.time|date='Y-m-d'}</div> <div class="article_content">{$content.content|raw}</div> <div class="prearticle">上一篇: <span class="color"> {if condition="$prevArticle"} <a href="{:url('index/index/article',array('id'=>$prevArticle.id))}" class="color">{$prevArticle.title}</a>{else/}没有了 {/if}</span> </div> <div class="nextarticle">下一篇: <span class="color"> {if condition="$nextArticle"} <a href="{:url('index/index/article',array('id'=>$nextArticle.id))}" class="color">{$nextArticle.title}</a>{else/}没有了 {/if}</span> </div>
php:
public function article() { $id=input('id'); $archivesData=Db::name('archives')->find($id); $categoryData=Db::name('category')->find($archivesData['cate_id']); $content=Db::name('archives_content')->where('archives_id',$id)->find(); //获取上一篇下一篇 $prevArticle=Db::name('Archives')->where('cate_id',$archivesData['cate_id'])->where('id','<',$id)->limit(1)->find(); $nextArticle=Db::name('Archives')->where('cate_id',$archivesData['cate_id'])->where('id','>',$id)->limit(1)->find(); return view('',[ 'categoryData'=>$categoryData, 'archivesData'=>$archivesData, 'content'=>$content, 'prevArticle'=>$prevArticle, 'nextArticle'=>$nextArticle ]); }
css:
.article_title{ font-size: 24px; width: 100%; text-align: center; font-size: 26px; margin-top: 35px; color: #666;} .article_time{ width: 100%;text-align: center; color: #aaa; margin-top: 10px;} .article_content{ margin-top: 20px; line-height: 28px; color: #666 } .prearticle{ margin-bottom: 10px; padding-top:30px; border-top: 1px solid #ccc; width: 100%;color: #666;}