简体   繁体   English

Dokuwiki中的自定义RSS feed

[英]Custom RSS feed in Dokuwiki

I'm using Dokuwiki to populate a site with a known set of pages. 我正在使用Dokuwiki用一组已知的页面填充网站。 Say, foo_1 through foo_9 . 说, foo_1foo_9 The content of those pages will change, but the names and locations never will. 这些页面的内容将改变,但名称和位置永远不会改变。

I want to provide a full-content RSS feed in a particular order of just those pages: 我想按这些页面的特定顺序提供完整的RSS提要:

foo_1
foo_2
foo_3
...
foo_9

Using the default syndication items it's not possible (it always uses the sort order of newest items at top), so I was thinking I'll need to create a customized copy of feed.php 使用默认的联合项目是不可能的(它始终使用最新项目的排序顺序),因此我想我需要创建feed.php的自定义副本

The problem is, I'm not a good enough PHP developer to know what I need to change. 问题是,我不是一个足够优秀的PHP开发人员,我不知道需要更改什么。 In feed.php on line 134 the function rss_buildItems looks like what I'd want to tweak. 在第134行的feed.php ,功能rss_buildItems看起来像我想要调整的内容。 Essentially, I'd like to pass it a simple array of the items to list in the correct order (assuming that would work), and then remove the call that gathers the information (that appears to me to be on line 288 the function getRecents() , but I'm a bit confused about that as well). 本质上,我想向其传递一个简单的项目数组,以正确的顺序列出(假设可以正常工作),然后删除收集信息的调用(在我看来,第288行的功能是getRecents() ,但对此我也有些困惑)。 So, I would need: 因此,我需要:

  1. The ID or other relevant page data for what I want to list. 我要列出的ID或其他相关页面数据。
  2. The format of the array. 数组的格式。
  3. The lines to block out to stop the date-based method of listing. 这些行将被阻止以停止基于日期的列表方法。

If anybody could get me started, or has any other ideas that might be easier, I'd be most appreciative. 如果有人可以让我入门,或者有其他可能更轻松的想法,我将非常感激。

I solved this by making a copy of the file feed.php , then taking line 288: 我通过复制文件feed.php来解决此问题,然后走第288行:

$recents = getRecents(0,$opt['items'],$opt['namespace'],$flags); 

And replacing it with something similar to this: 并用类似以下内容替换它:

$recents = array(array(     "date" => "",
                           "ip" =>  "::1", 
                            "type" => "E",
                            "id" => "foo",
                            "user" => "user",
                            "sum" => "",
                            "extra" => "",
                            "perms" => "1"
                            ),
                    array(  "date" => "",
                            "ip" =>  "::1", 
                            "type" => "E",
                            "id" => "bar",
                            "user" => "user",
                            "sum" => "",
                            "extra" => "",
                            "perms" => "1"
                     )                  
                 ); 

Seems to work great. 似乎工作很棒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM