Article details display function
1, modify the indexHtml.php code:
##2, create and edit ArticleShow .php
Prepare data:
All category information:$categories
Details of the currently clicked article:$result
What articles are under the current category:$articles
fetchRow($sql); //文章对应的分类id $cid=$result['cid']; //当前分类下有哪些文章 $sql="select *from cms_article where cid=$cid"; $articles=$db->fetchAll($sql); $sql="select name from cms_category where id=".$result['cid']; $cname=$db->fetchRow($sql); $result['cname']=$cname['name']; //所有分类信息 $sql="select name from cms_category ORDER BY sort"; $categories=$db->fetchAll($sql); require 'ArticleShowHtml.php';3 , Create a new ArticleShowHtml.php file Picture display:
Just traverse the red box displayed in the picture
The specific code is as follows:
Title 分类: > 正文日期: