08/01/07

Permalink 11:21:55 pm, by robertc Email , 444 words, 4403 views   English (UK)
Categories: Web Develop, Server Side Web Development Share on reddit Share on digg Share on del.icio.us Share on ma.gnolia.com Share on StumbleUpon

Adding discoverable RSS feeds to phpBBPlus

Last week I added RSS feeds to a forum I help manage. It wasn't too difficult, or even that original, but I thought I'd document it here in case I have to do it again :)

First step is to get an RSS feed set up. I used the naklon.info mod - it's self contained but integrates well, enforcing HTTP authentication for accessing private forums. The key thing about this mod is it allows you to generate forum specific and topic specific feeds by adding the f=x and topic=x parameters to the URL.

OK, so to make your RSS feeds discoverable you need to add a link element in the <head> element of the page. Here's the one from this blog, which you can see by viewing the source code:

<link rel="alternate" type="text/xml" title="RSS 2.0" href="http://www.boogdesign.com/b2evo/index.php?tempskin=_rss2" />

PhpBBPlus already has a mechanism for adding link elements - it's to add buttons to the 'Mozilla navigation bar' - so I'm just going to subvert that mechanism. First up, the file which actually builds the links is includes/page_header.php - the standard link template doesn't include the type attribute we need. Rather than risking breaking the existing template, I just added a new one. After:

$nav_link_proto = '<link rel="%s" href="%s" title="%s" />' . "\n";

I added:

$rss_link_proto = '<link rel="%s" type="application/rss+xml" href="http://www.lanarchy.co.uk/%s" title="%s" />' . "\n";

Then further down I modified the code to check the link type:

if ($nav_item == 'alternate') {
$nav_links_html .= sprintf($rss_link_proto, $nav_item, append_sid($nav_array['url']), $nav_array['title']);
} else {
$nav_links_html .= sprintf($nav_link_proto, $nav_item, append_sid($nav_array['url']), $nav_array['title']);
}

Next I modified the viewforum.php and viewtopic.php files to add in the links. In viewforum.php, I found the 'Mozilla navigation bar' section and appended the following:

$view_forum_rss = append_sid("rss.$phpEx?" . POST_FORUM_URL . "=$forum_id");
$nav_links['alternate'] = array(
'url' => $view_forum_rss,
'title' => 'RSS 2.0'
);

Then in viewtopic.php, again in the 'Mozilla navigation bar' section (it's marked by a comment), I added the same bit of code. Note that this means both the forums and the topics will present a feed for the forum. I preferred it this way as some of the topics aren't going to have that many updates and I figured the forum feed would be more generally useful, but it would be semantically more correct to change the viewtopic.php URL to use the topic parameter.

03/01/07

Permalink 06:55:08 pm, by robertc Email , 119 words, 308 views   English (UK)
Categories: Web Develop, Server Side Web Development Share on reddit Share on digg Share on del.icio.us Share on ma.gnolia.com Share on StumbleUpon

Fixing blo.gs ping in b2evo

I noticed that the b2evolution ping feature has been failing for blo.gs for some time, it seems some other folk have encountered the same problem. I looked up the blo.gs ping documentation and it seems they've recently unified the ping service with the one at Yahoo! (who bought them out a while back), which means the RPC address has changed.

It seems easy enough to fix, open up the file inc/_misc/_ping.funcs.php and look for this line:

$client = new xmlrpc_client('/', 'ping.blo.gs', 80);

Change it to:

$client = new xmlrpc_client("/RPC2", "ping.feeds.yahoo.com", 80);

And it should start working again. (At least I hope so, I'm just about to try it...)

Permalink 06:29:31 pm, by robertc Email , 287 words, 508 views   English (UK)
Categories: Web Develop, Server Side Web Development Share on reddit Share on digg Share on del.icio.us Share on ma.gnolia.com Share on StumbleUpon

More little buttons of sharing

In an earlier post, I described how I added 'share on reddit' and 'share on delicious' buttons to my b2evo skin. Today I spent some time cleaning up and adding new buttons for Digg and Ma.gnolia.

I noticed on Arto Bendiken's blog his 'sharing buttons' also added a title after you click on them. It didn't seem like it would be too difficult to extend my previous code, and it wasn't ;) Here's what I've finished up with in _main.php:

<h3 class="bTitle">
  <?php $Item->title(); ?>
  <a href="http://reddit.com/submit?url=<?php echo $Item->get_permanent_url(); ?>&title=<?php echo $Item->title; ?>"><img src="/images/reddit.png" alt="Share on reddit" class="middle" /></a>
  <a href="http://digg.com/submit?phase=2&url=<?php echo $Item->get_permanent_url(); ?>&title=<?php echo $Item->title; ?>"><img src="/images/digg.png" alt="Share on digg" class="middle" /></a>
  <a href="http://del.icio.us/post?url=<?php echo $Item->get_permanent_url(); ?>&title=<?php echo $Item->title; ?>"><img src="/images/delicious.png" alt="Share on del.icio.us" class="middle" /></a>
  <a href="http://ma.gnolia.com/bookmarklet/add?url=<?php echo $Item->get_permanent_url(); ?>&title=<?php echo $Item->title; ?>"><img src="/images/magnolia.png" alt="Share on ma.gnolia.com" class="middle" /></a>
</h3>

Hot Topics

Popular

boogdesign posts

Longer posts on standards based web design, portable web development and Linux, intermingled with some stuff on my other nerd interests.

Search

Syndicate this blog XML

  • RSS 0.92 Posts RSS 0.92 Comments
  • RSS 1.0 Posts RSS 1.0 Comments
  • RSS 2.0 Posts RSS 2.0 Comments
  • Atom Posts Atom Comments
What is RSS?

License info

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 2.5 License.

powered by
b2evolution

get hCard