[RC2]RSS Feed

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Ideas Centre
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [beta]RSS Feed

Post by joeroberts »

and right below <html>
like so

Code: Select all

<html>
<link rel="alternate" type="application/rss+xml" title="Forum" href="forumrss.php">
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [beta]RSS Feed

Post by joeroberts »

Up dating file to include
  1. header image with link to site
  2. set number of listings to work with config posts perpage
  3. fixed $auth to include post
  4. added pundate
  5. removed mention of .css file
kevbot
Registered User
Posts: 3
Joined: Sun Apr 06, 2008 8:46 am

Re: [beta]RSS Feed

Post by kevbot »

Hello!

I just put this up on my site and noticed a few problems... I've fixed them for myself and here they are:

The main query was taking over two minutes to run on my server for a site with only around 12,000 posts. I've modified it to remove the subquery for "aantal_posts" (this value is recorded as 'topic_replies' in the topics table) and switched to using joins instead of a cross product. I've also put in a distinct on topid_id so that I'd only get one copy of each topic in a feed. This required changing

Code: Select all

            $replies = $row['aantal_posts'] - 1;
to

Code: Select all

            $replies = $row['aantal_posts'];
as well as modifying the query to the one below. The query runs in less than a millisecond now on my server.

Code: Select all

        $query = "
            SELECT distinct(p.topic_id) , p.forum_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid,
                u.user_id, u.user_email, u.username, u.user_posts, u.user_rank, u.user_colour, u.user_allow_viewonline, u.user_allow_viewemail,
                t.topic_title, f.left_id, f.right_id, t.topic_replies as aantal_posts
            FROM " . POSTS_TABLE . " p JOIN " . USERS_TABLE . " u on p.poster_id = u.user_id JOIN " . TOPICS_TABLE . " t on p.topic_id = t.topic_id JOIN ". FORUMS_TABLE ." f on p.forum_id = f.forum_id
            GROUP BY topic_id
            ORDER BY t.topic_last_post_time DESC
            LIMIT {$topic_count}
        ";
Also, there was an error in the line that displayed "View latest post". This caused the associated image to possibly have an incorrect path as the path to the phpbb installation was not included. The line looking like this:

Code: Select all

          <a href="'.$config['server_protocol'].$config['server_name'].$forum_folder.'viewtopic.php?f='.$row['forum_id'].'&t='.$row["topic_id"].'&p='.$last_post.'#p'.$last_post.'">'.str_replace('./',$config['server_protocol'].$config['server_name'].'/',$user->img('icon_topic_newest', 'VIEW_LATEST_POST')).'</a><b> ON: '.$user->format_date($last_poster_time).'</b><br />
should be replaced with:

Code: Select all

          <a href="'.$config['server_protocol'].$config['server_name'].$forum_folder.'viewtopic.php?f='.$row['forum_id'].'&t='.$row["topic_id"].'&p='.$last_post.'#p'.$last_post.'">'.str_replace('./',$config['server_protocol'].$config['server_name'].'/'.$forum_folder,$user->img('icon_topic_newest', 'VIEW_LATEST_POST')).'</a><b> ON: '.$user->format_date($last_poster_time).'</b><br />
Note that I just added '$forum_folder' in the str_replace.

Hopefully you'll find these useful, and thanks for the code!
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

I have added your changes and fix one other small error in code and every thing is testing fine
kevbot
Registered User
Posts: 3
Joined: Sun Apr 06, 2008 8:46 am

Re: [RC1]RSS Feed

Post by kevbot »

Sorry, but would you mind posting specifically what the other error was? I've made some other changes that are specific to my site so I can't just drop in the code from the first page any more.

Thanks!
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

change

Code: Select all

		$author = ($row['username'] = 'Anonymous')? 'Anonymous@nowhere.com' : $row['user_email'];
to

Code: Select all

		$author = ($row['username'] == 'Anonymous')? 'Anonymous@nowhere.com' : $row['user_email'];
kevbot
Registered User
Posts: 3
Joined: Sun Apr 06, 2008 8:46 am

Re: [RC1]RSS Feed

Post by kevbot »

Ah, thanks... I'd noticed that but then promptly forgotten about it.

Thanks!
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

adding new features to work with search and need a tester
you can get files here
proterra
Registered User
Posts: 11
Joined: Fri May 13, 2005 4:57 pm

Re: [RC1]RSS Feed

Post by proterra »

I don´t know why when call the file:

http://www.domain.de/forum/forumrss.php

I get a blank site without any design that looks like this:

Code: Select all

http://www.domain.de/forum/images/favicon.ico http://www.domain.de/forum/ Website Name
http://www.domain.de/forum/styles/prosilver/imageset/announce_read.gif  http://www.domain.de/forum/ en-us  60   http://www.domain.de/forum/viewtopic.php?f=40&t=4119
http://www.domain.de/forum/viewtopic.php?f=40&t=4119   email@gmx.de (Username)  Sun, 13 Apr 2008 15:52:20 CEST    http://www.domain.de/forum/viewtopic.php?f=28&t=4121  email@gmx.de (username) Sun, 13 Apr 2008 15:18:53 CEST http://www.domain.de/forum/viewtopic.php?f=37&t=4133
But if I look in the source-code of this site its looks like an normal rss-feed. But why not If I choose the forumrss.php?
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

proterra wrote:I don´t know why when call the file:

http://www.domain.de/forum/forumrss.php

I get a blank site without any design that looks like this:

Code: Select all

http://www.domain.de/forum/images/favicon.ico http://www.domain.de/forum/ Website Name
http://www.domain.de/forum/styles/prosilver/imageset/announce_read.gif  http://www.domain.de/forum/ en-us  60   http://www.domain.de/forum/viewtopic.php?f=40&t=4119
http://www.domain.de/forum/viewtopic.php?f=40&t=4119   email@gmx.de (Username)  Sun, 13 Apr 2008 15:52:20 CEST    http://www.domain.de/forum/viewtopic.php?f=28&t=4121  email@gmx.de (username) Sun, 13 Apr 2008 15:18:53 CEST http://www.domain.de/forum/viewtopic.php?f=37&t=4133
But if I look in the source-code of this site its looks like an normal rss-feed. But why not If I choose the forumrss.php?
can you PM me a copy of the source code you see?
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

Please make sure that when you creat you new forumrss.php
you do not have any blanks or white spaces infront of <?php
tupeu
Registered User
Posts: 320
Joined: Wed Jul 25, 2007 5:47 pm
Location: roFLmania
Contact:

Re: [RC1]RSS Feed

Post by tupeu »

great mod, thank you :-)
lolauk
Registered User
Posts: 108
Joined: Fri Aug 17, 2007 8:03 pm

Re: [RC1]RSS Feed

Post by lolauk »

i think mines isnt working.
i have the line to add to overall header - i cant find <html> but i have found <html xmlns in the second line so i have added it under this.....but it doesnt work, i have also tried to add it to other areas and still no luck.

when i go onto /forumrss.php i get just jumble on my screen - nothing like the xml/rss reader everyone else is getting :S
Image
What am i doing wrong?
User avatar
joeroberts
Registered User
Posts: 272
Joined: Fri Jun 22, 2007 7:19 pm
Contact:

Re: [RC1]RSS Feed

Post by joeroberts »

please read my prior post about white spaces in front of <?php
proterra
Registered User
Posts: 11
Joined: Fri May 13, 2005 4:57 pm

Re: [RC1]RSS Feed

Post by proterra »

How can I integrate the feed in my footer-template?

I tested a variation over feed2js, but that didn´t show me the feed.

Thanks for help
Locked

Return to “[3.0.x] MODs in Development”