Article details display function

1, modify the indexHtml.php code:

微信图片_20180306165749.png

##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:

微信图片_20180306170529.png

Just traverse the red box displayed in the picture

The specific code is as follows:

    Title      
首页 > > > 详细内容
 
分类: > 正文
日期: 


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!