如果你想尝试使用API的方法可以 点击这里 查看
前言
本文火喵原创,禁止原文转载,部分引用请标明参考出处及本文链接!!!
今天翻博客,无意中找到了一篇“简单而完整的 PHP RSS 阅读器”。尝试之后大为惊喜。这个短短的20行代码也正好是最近在找的,立刻就在首页添加了用此方法写来的“178动漫新闻”的侧边栏,效果非常不错,于是尝试了一下制作新一版的新闻早报,此方法使用了简单的RSS引用方式,不必再受api资源的限制,而且可扩展性也非常强,在此也分享给大家
为何选用rss方式更加比api具有优势呢?
- rss订阅源丰富,更新节奏快,api更新不稳定,我之前的方法就经常中午才更新,这还能叫早报么
- api大部分都有调用次数显示,比如上一篇 JOE主题首页显示新闻早报API,可每日更新(功能可扩展) 中使用的
ALAPI
,每日仅1000次调用次数 - rss的源不仅仅是新闻,更加丰富的订阅来源,而api也就那几种了。
- emmm还有啥
效果图
![2021-9-8-18-6-56.png](https://image.mmbkz.cn/blog2021/2021-9-8-18-6-56.png-shuiyin)
新闻页创建
和上次的方法一样,我们也是创建一个单独的页面来作为新闻页。
- 从
\usr\themes\Joe
复制出一份page.php
,并在头部添加
<?php
/**
* 新闻2
*
* @package custom
*
**/
?>
寻找到
php 代码:<?php $this->need('public/article.php'); ?>
<?php $this->need('public/handle.php'); ?>
在这两行代码之间,添加
其中第二行就是我们选择的rss
订阅地址,这里火喵选的是奇客Solidot–传递最新科技情报
,当然你也可以换成别的,比如文章最后推荐的几个源,你也可以百度。
在后台新建页面
,模板选择新闻2
,地址栏可以填写diarynews2
,然后发布查看效果。
如果感觉标题多余,可以删除代码中的
php 代码: <h1 style="text-align:center;">
火喵科技新闻报
</h1>
或者
php 代码:<?php $this->need('public/batten2.php'); ?>
我这里删除了前者。
设置首页文章流(可选)
为了使新闻看起来更加自然方便,我们在首页添加新闻,使其看起来和文章浑然一体,此方法仅限joe7.x
主题
- 修改
index.php
,Ctrl
+F
查找<div class="joe_index__list" data-wow="<?php $this->options->JList_Animate() ?>">
- 在此代码上方位置粘贴如下代码
记得相应修改代码中的页面地址。
注意事项
- 修改前记得备份
- 图片可以换成自己的图
- 跳转错误记得修改成自己的内页链接,你可能需要将
/dailynews2.html
改成/index.php/dailynews2.html
RSS源推荐
- 如果你还不清楚去哪找RSS源 https://www.zhihu.com/question/19580096
- 如果你想找更多的源 https://docs.rsshub.app/
看看
暂无点赞
前来预习
暂无点赞
学习一下
暂无点赞
学习学习
暂无点赞
感谢分享
暂无点赞
学习一下
暂无点赞
终于找到这样的教程了
暂无点赞
来踩
暂无点赞
学习一下!!!!!
暂无点赞
学习学习,谢谢
暂无点赞
可以的
暂无点赞
可以的,学习了,感谢博主分享~
暂无点赞
来学习了,谢谢分享
暂无点赞
来学习了 谢谢大佬分享
暂无点赞
我吐了,现在电脑上两个浏览器都特么进不来你网站了,啥也没开一直给我跳禁f12的页面,无大语。。![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
我电脑一个chrome86,一个edge,从没遇到你说的情况,不过也有小伙伴反映过这个问题,你试试强制刷新
为啥我手机也会乱蹦F12![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
手机应该是浏览器不兼容,但是我的尝试中只有苹果会这样
暂无点赞
为啥我的QQ号是倒着输出的呢?![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
就我的QQ号7382开头的,输出后2837结尾的……
我试了好用的呀,第一次听说还有倒着输出的
,你是不是压到键盘左键了哈哈哈哈哈
不是的啊~我用的手机,键盘也没左键,我都已经录屏了的,要不你联系我下,我把视频发你~
kangluyi@kangluyi.cn
那就是手机浏览器兼容性有问题了,换个浏览器试试吧,比如chrome![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
暂无点赞
暂无点赞
暂无点赞
暂无点赞
暂无点赞
说不定问题在喵喵的javascript函数中的判断打开devtools的机制之中![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZ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lnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
暂无点赞
暂无点赞
暂无点赞
多些分享,正好是我所需要的
暂无点赞
多谢奥,看看咋用
暂无点赞
这貌似就是我想找的,找了好久的![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3Z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B6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
哈哈哈好滴![](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0Ij48cGF0aCBmaWxsPSJub25lIiBkPSJNMCAwaDI0djI0SDB6Ii8+PHBhdGggZD0iTTEyIDIyQzYuNDc3IDIyIDIgMTcuNTIzIDIgMTJTNi40NzcgMiAxMiAyczEwIDQuNDc3IDEwIDEwLTQuNDc3IDEwLTEwIDEwem0wLTJhOCA4IDAgMSAwIDAtMTYgOCA4IDAgMCAwIDAgMTZ6bS01LTdoMmEzIDMgMCAwIDAgNiAwaDJhNSA1IDAgMCAxLTEwIDB6bTEtMmExLjUgMS41IDAgMSAxIDAtMyAxLjUgMS41IDAgMCAxIDAgM3ptOCAwYTEuNSAxLjUgMCAxIDEgMC0zIDEuNSAxLjUgMCAwIDEgMCAzeiIgZmlsbD0icmdiYSgxNDksMTY0LDE2NiwxKSIvPjwvc3ZnPg==)
暂无点赞
暂无点赞
暂无点赞
暂无点赞
暂无点赞
文章不错,拿走啦:@(aa24)
暂无点赞
很喜欢博主的这片文章
暂无点赞