静态化 - PHP静态页如何显示最新新闻

WBOY
Release: 2016-06-06 20:37:44
Original
985 people have browsed it

比如我有一个静态页面,基于phpcms系统,页面是新闻内容页,我想做个“最新新闻”模块,因为是静态页面不能及时显示最新文章吧,我想到几个办法:1.频繁的全站生成所有页面,但是太麻烦又耗时 2.用一个iframe引用一个动态页,这个动态页显示最新新闻 3.用ajax请求最新新闻显示出来

一般做法是哪种,或者有更好的办法?不吝赐教!

页面举例:http://www.dayecn.com/science/2244.html

回复内容:

比如我有一个静态页面,基于phpcms系统,页面是新闻内容页,我想做个“最新新闻”模块,因为是静态页面不能及时显示最新文章吧,我想到几个办法:1.频繁的全站生成所有页面,但是太麻烦又耗时 2.用一个iframe引用一个动态页,这个动态页显示最新新闻 3.用ajax请求最新新闻显示出来

一般做法是哪种,或者有更好的办法?不吝赐教!

页面举例:http://www.dayecn.com/science/2244.html

http://news.sina.com.cn/c/2015-02-28/024431550484.shtml
看了新浪新闻右侧的热点博客,是用的ifrmae

本质就是不同的缓存策略共存问题

script:src嵌入是另一种方案

这里面iframe基本上是灾难应该淘汰。
Ajax代码相对复杂,速度也比不过script:src(需要等js运行才发请求),不建议。

剩下的script:src和静态生成各有所长,看情况吧(其实也可以组合的,script:src的链接可以是另一份静态生产的内容……)

ssi

shtml

pls google it!~

搞这么麻烦
include 'your_latest_news.file';
然后cron job 每隔多长时间generate这个your_latest_news.file

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!