Not logged in. · Lost password · Register
Forum: General Help and Support Features and Functionality RSS
Tweaking RSS output
How to change the title of a feed item to make it the first header in the entry?
Avatar
loki #1
Member since Feb 2007 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Tweaking RSS output
Hi, I'm exporting my wiki's rss to my blog's sidebar with a plugin I wrote using SimplePie. I also installed the feed plugin to consume the comments feed as well (comments generated using the discussion plugin, by the same author), and noticed that the plugin-generated feed uses the first heading in the entry rather than page id. I like this output better and would like to have the wiki's main feed do the same thing.

So for instance if it were a feed item for this page, the feed item title would read "Feed Plugin - revision summary" rather than "plugin:feed - revision summary." Problem is, I have no idea which files to modify, or how. I am not an expert user by any means and have only a basic knowledge of PHP. I know a tiny bit about how to handle SimplePie, from having written a blog plugin to consume feeds. Any help to get the result I want would be much appreciated.

There's a related, lower-priority modification I'd like to make. I've noticed that the main feed uses the user's full name as author name, while the plugin-generated feed uses the user id. I'd like the plugin-generated feed to use the full name as well, for uniformity. I presume I need to change line 153 of feed.php:

//creator
if ($page['user']) $item->author = $page['user'];

What variable should I put in instead of $page['user']?
Avatar
loki #2
Member since Feb 2007 · 6 posts
Group memberships: Members
Show profile · Link to this post
Edit: Grar. All I needed to do was edit the configuration and check "Use first heading for pagenames." I can see why my fix below did the job and certainly learned something in the process, but it was unnecessary. (Feels foolish)


I seem to be making a habit of answering my own questions. I finally solved it! I consulted this fix by Joe Lapp, though it wasn't directly useable. Probably because the DW distribution has changed since then. What I did was the following.

In feed.php in the wiki root folder, I took the following portion:

if($conf['useheading'] && $meta['title']){
  $item->title = $meta['title'];
}else{
  $item->title = $recent['id'];
}

And replaced it with:

if($conf['useheading']){

  $heading = p_get_first_heading($recent['id']);

  if(!empty($heading)){
    $item->title = trim($heading);
  }
}
elseif($meta['title']){
  $item->title = $meta['title'];
}
else{
  $item->title = $recent['id'];
}

I'm not sure if it's 100%, but it works as intended at the moment. Some of the older feed items still show the old titling, which seems to be a cache issue.

I'm so happy I finally got this! Now if only I can get the item author thing to line up, I will be a happy woman indeed.
This post was edited 2 times, last on 2007-03-16, 22:33 by loki.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-08-22, 03:10:01 (UTC +02:00)