How to make the news list page phpcms

Previous blog we say how phpcms create a single page at the following address
phpcms add a section for each of the modules
we all know that a Web site, be sure to have a list of news, all the news, what's notice, which notice information are written down in the form of a list, this time, a single page would not be able to meet, then we need to create columns, as we fill the news pages
Here Insert Picture Description
first we create a new column, the type of news we write articles on the type, after all, news Well written articles are to
Here Insert Picture Description
template settings here has gone wrong, was not any election, and not panic, since it is a list of pages, then we need a list.html, then every news we also need to prepare a show.html to hold news content, this time, we just need to do a static list of pages that we renamed list.html, news content like page creation show.html
Here Insert Picture Description

The following is a good display
Here Insert Picture Description
this time we can see, you can select the type of
Here Insert Picture Description
After updating the cache column, we can see more than a month this
Here Insert Picture Description
is our news list, he is the second of. A list of pages, the specific content of a page, how do we add content?

I remember we had to add a single page of content when (Click here if you can not clear the portal of phpcms it becomes static single page dynamically modifiable )
by {$title}and {$content}for incoming content, the list also echoes the
news page into list page and show pages, we look at the list and show phpcms comes
first to show the page
Here Insert Picture Description
we can see inside there are a lot of labels, including Han's comments are also included, but those we do not need to know, because this is a template, What we need, to take over the direct use on the line, such as our body is actually needed a title page, a date, and a body like, at most, to a source, so we need these labels

{$title}   //标题
{$content}  //正文
{$inputtime}  //来源
{date('Y-m-d')}  //时间

修改完就是这样
Here Insert Picture Description
下面是list文件
Here Insert Picture Description
里边

{pc:content action="hits" catid="$catid" num="10" order="views DESC" cache="3600"}
	{loop $data $r}
		<li><a href="{$r[url]}" target="_blank">{$r[title]}</a></li>
	{/loop}
{/pc}

用来循环每一个list内容
其中{$r[url]}就是要连接过去的我们的新闻内容页,它会自动链接,我们只需要写上这个就行,而{$r[title]}则是新闻标题。我们也可以按照这种方式来控制新闻长度str_cut($[title], 40)就是控制长度为40个单位(不是40个汉字,具体可以试试看),所以我们修改如下
Here Insert Picture Description
之前我们可能在静态页面写好多个a标签,现在只需要一个就行,然后循环获取。这个时候我们就可以发表一篇公告试一试
Here Insert Picture Description
Here Insert Picture Description‘填好后我们点击进行测试一下
Here Insert Picture Description
会发现列表页多了一个内容
Here Insert Picture Description
点击进去,会发现这个内容
Here Insert Picture Description
然后我们再利用{$CATEGORYS[9]['url']}标签进行链接(有关该标签的内容看这里传送门)这里的链接是more这个按钮,看下图
Here Insert Picture Description
我们找到这个按钮,写上地址即可,好是好了,就是首页的这些数据咋办???
不慌,我们依旧按照列表的循环规则
Here Insert Picture Description
这是首页的HTML,就是注意这里的catid就要改一下了,改成通知公告对应的ID我这里是10
Here Insert Picture Description
我们在上边没修改,是因为list页面本身就是那个通知公告页面,而$catid则就是表示当前页面
num = 10表示的是在首页显示10条数据
Here Insert Picture Description
可以看到我们的内容传递过来了

发布了62 篇原创文章 · 获赞 20 · 访问量 5790

Guess you like

Origin blog.csdn.net/weixin_44415928/article/details/104448472