[MODDB] simple syndication

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
Locked
mrcnet
Registered User
Posts: 3
Joined: Mon Dec 17, 2007 5:43 pm

Re: [BETA] simple syndication

Post by mrcnet » Mon Dec 17, 2007 5:49 pm

I try this mod but It's doesn't works

IF I type http://www.mysite.com/forum/syndication ... t=10&fid=1

the scripts works graeat

but IF I type http://www.mysite.com/forum/syndication ... &fid=1,2,5

or simply http://www.mysite.com/forum/syndication.php?count=10

the script doesn't works.. It show a blank page

what can I do to return all 100 last topic FROM ALL FORUMS?

04nunhucks
Registered User
Posts: 58
Joined: Sat Dec 23, 2006 2:02 pm

Re: [BETA] simple syndication

Post by 04nunhucks » Mon Dec 17, 2007 8:34 pm

Syndication Error:
An invalid character was found in text content.
Line: 102 Character: 4710

<description><![CDATA[<span style="text-decoration: underline"><span style="font-family:Arial Black;"><span style="color: #ff0000"><span style="font-size: 120%; line-height: 116%;">I AM LEGEND</span></span></span></span> <br /><br /><img src="http://i185.photobucket.com/albums/x19/ ... d_ver4.jpg" alt="Image" /> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;"><blockquote class="uncited"><div> </span></span></span><br /><span style="font-family:Arial Black;"></span><br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Robert Neville is a brilliant scientist, but even he could not contain the terrible virus that was unstoppable, incurable, and man-made. Somehow immune, Neville is now the last human survivor in what is left of New York City and maybe the world. For three years, Neville has faithfully sent out daily radio messages, desperate to find any other survivors who might be out there. But he is not alone. Mutant victims of the plague -- The Infected -- lurk in the shadows... watching Neville's every move... waiting for him to make a fatal mistake. Perhaps mankind's last, best hope, Neville is driven by only one remaining mission: to find a way to reverse the effects of the virus using his own immune blood. But he knows he is outnumbered... and quickly running out of time. </span></span></span><br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;"></div></blockquote></span></span></span> <br /><span style="font-family:Arial Black;"></span><br /><span style="font-family:Arial Black;"></span><br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">IMDb Info >>> </span></span></span><a href="http://www.imdb.com/title/tt0480249/plotsummary" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.imdb.com/title/tt0480249/plo ... </span></a> <br /><span style="font-family:Arial Black;"></span><br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Movie Links >>></span></span></span> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Part 1 </span></span></span><a href="http://www.veoh.com/videos/v16476728PXzbZy6" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.veoh.com/videos/v16476728PXz ... </span></a> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Part 2 </span></span></span><a href="http://www.veoh.com/videos/v1647676fnk8trbJ" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.veoh.com/videos/v1647676fnk8 ... </span></a> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Part 3 </span></span></span><a href="http://www.veoh.com/videos/v1647696EMq3knzW" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.veoh.com/videos/v1647696EMq3 ... </span></a> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Part 4 </span></span></span><a href="http://www.veoh.com/videos/v1647681et6mwTSP" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.veoh.com/videos/v1647681et6m ... </span></a> <br /><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">Part 5 </span></span></span><a href="http://www.veoh.com/videos/v16477007zQqKQNX" class="postlink"><span style="font-family:Arial Black;"><span style="color: #00b050"><span style="font-size: 100%; line-height: 116%;">http://www.veoh.com/videos/v16477007zQq ... </span></a> <br /><br /><br /><img src="http://i185.photobucket.com/albums/x19/ ... d_ver6.jpg" alt="Image" /> <br /><br /><br /><span style="font-family:Arial Black;"><span style="color: #ff0000"><span style="font-size: 100%; line-height: 116%;">Enjoy! </span></span></span>
That looks tasty lol ;)

My site is: filmzfanatic.co.nr

mrcnet
Registered User
Posts: 3
Joined: Mon Dec 17, 2007 5:43 pm

Re: [BETA] simple syndication

Post by mrcnet » Thu Dec 20, 2007 9:02 am

angelside wrote:MOD Title: simple syndication
MOD Description: phpBB 3.0 rss/atom content syndicator
MOD Version: 1.1.1b

MOD Download: http://downloads.sourceforge.net/canver ... .1b.tar.gz

Demo Board: http://www.phpbbturkiye.net/syndication.php?fid=20&t=1


changelog from 1.0.0b
* fix minor error
* add new parameter for show topic only first post


Updated on: 2007-06-20 - Version 1.1.1b
also in the demo board, if no fid the page is blank:

http://www.phpbbturkiye.net/syndication.php?t=1

I want to show all topics of all forums

covex
Registered User
Posts: 21
Joined: Fri May 04, 2007 7:12 am

Re: [BETA] simple syndication

Post by covex » Thu Dec 20, 2007 11:47 am

I tried this mod on phpbb3 gold running on postgre and default syndication.php output is empty.

EDIT: So it seems the problem is in $count.
Changing
$result = $db->sql_query_limit($sql, $count);
to e.g.:
$result = $db->sql_query_limit($sql, 20);

results in that syndication.php?type=rss returns rss fead with 20 posts
?type=atom returns 20 atom posts, but those are not visible in firefox. Therefore remove
<link rel="alternate" type="application/atom+xml" title="{SITENAME}" href="syndication.php?type=atom" />
from your overall_header.html.

mbradford
Registered User
Posts: 14
Joined: Thu Jun 15, 2006 7:17 pm

Re: [BETA] simple syndication

Post by mbradford » Sat Dec 22, 2007 7:44 pm

Thanks for this mod! I'm a non-coder, so this stuff is pretty foreign to me. (I still design simple sites in FrontPage.) :)

But I was able to install this mod, thanks to the instructions in the file, and it works great.

However, I need to find a way to fix this problem... There is no space between the last line of a post and the title line of the next post. So the posts appear to run together. I'm using the Feed2js.org RSS-to-HTML Converter, which allows you to place code in a website that shows the RSS feed on the page.

All this is working fine, except that it really looks bad when the last line of one post is right above the next post title.

Is there a line of code or something that can change this - to add a line of space between the posts? Or, it would be even better if it would add an actual line (like a stretched .gif) between the posts...

(Just FYI... If anyone uses that Feed2js.org RSS-to-HTML Converter, it will mess up apostrophes, quotes and other characters. So you have to go to the Help section on that site, and in the FAQs, it gives you a line of code to change (UTF or something). This solves the problem.)

Tom Keels
Registered User
Posts: 30
Joined: Wed Jun 05, 2002 2:29 pm

Re: [BETA] simple syndication

Post by Tom Keels » Sat Dec 22, 2007 11:52 pm

I finally got this to work the way I wanted in phpBB3 Gold. This is similar to how another PHPBB2 rss mod I had before. Here is the way it worked and how I liked it.

Showed the last 30 active Topics - Title Only
Link in the reader takes you to the last post in the topic, not the first post as is in this mod.

Here's what needs changing:

Find

Code: Select all

$sql = 'SELECT p.poster_id, p.post_subject,
Find Inline

Code: Select all

p.poster_id
Before Add

Code: Select all

t.topic_last_post_id, p.post_id,

Find

Code: Select all

		'LINK'			=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
		'IDENTIFIER'	=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),

Replace with

Code: Select all

      		'LINK'         => append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']. '&p=' . $row['post_id'] .'#p' . $row['topic_last_post_id']),
      		'IDENTIFIER'   => append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']. '&p=' . $row['post_id'] .'#p' . $row['topic_last_post_id']),

This may not be the way you want it to work, but it works for me and it's how I like it.

Enjoy!

Haaid
Registered User
Posts: 13
Joined: Mon Dec 01, 2003 9:16 am

Re: [BETA] simple syndication

Post by Haaid » Sun Dec 23, 2007 3:25 pm

if I try and apply your changes I get this error:


(i renamed syndication.php to syndication2.php myself. it did not work without the filename changed either)
General Error
SQL ERROR [ mysqli ]

Unknown column 't.topic_last_post_id' in 'field list' [1054]

SQL

SELECT t.topic_last_post_id, p.post_id, p.poster_id, p.post_subject, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.topic_id, p.forum_id, p.post_time, f.forum_name, f.forum_desc_options, u.username FROM phpbb3_posts as p, phpbb3_forums as f, phpbb3_users as u WHERE (u.user_id = p.poster_id) AND p.post_approved = 1 AND (f.forum_id = p.forum_id) ORDER BY post_time DESC LIMIT 30

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/db/mysqli.php
LINE: 185
CALL: dbal_mysqli->sql_query()

FILE: includes/db/dbal.php
LINE: 157
CALL: dbal_mysqli->_sql_query_limit()

FILE: syndication2.php
LINE: 134
CALL: dbal->sql_query_limit()

Tom Keels
Registered User
Posts: 30
Joined: Wed Jun 05, 2002 2:29 pm

Re: [BETA] simple syndication

Post by Tom Keels » Sun Dec 23, 2007 3:32 pm

Sorry, you need to have the topics_only flag set to 1

You can do that in the html string or in the syndication.php file itself. I did the latter.

Code: Select all

$topics_only = '1';
Also to limit the topics to the last 30 I changed the CFG settings in the file to this

Code: Select all

$CFG['max_topics'] 		= '30';
Sorry for the confusion.

seite7
Registered User
Posts: 1
Joined: Sun Dec 23, 2007 3:42 pm

Re: [BETA] simple syndication

Post by seite7 » Sun Dec 23, 2007 3:47 pm

The coding for the Atom feed is a little bit strange. Because it uses sessions, every time you reload the feed in the feed reader all post will be marked new.

You should change:

Code: Select all

#'LINK'			=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
		#'IDENTIFIER'	=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
To:

Code: Select all

'LINK'			=> "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
		'IDENTIFIER'	=> "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
This will remove the session_ids and create a link that not only links to the topic but also to the right post. Make sure to also include p.post_id in the sql query.

Ralf

Tom Keels
Registered User
Posts: 30
Joined: Wed Jun 05, 2002 2:29 pm

Re: [BETA] simple syndication

Post by Tom Keels » Sun Dec 23, 2007 4:04 pm

seite7 wrote:The coding for the Atom feed is a little bit strange. Because it uses sessions, every time you reload the feed in the feed reader all post will be marked new.

You should change:

Code: Select all

#'LINK'			=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
		#'IDENTIFIER'	=> append_sid("$board_url/viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']),
To:

Code: Select all

'LINK'			=> "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
		'IDENTIFIER'	=> "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
This will remove the session_ids and create a link that not only links to the topic but also to the right post. Make sure to also include p.post_id in the sql query.

Ralf

Thanks Ralf, I was wondering why that was happening, I suspected the sid. FireFox live bookmarks seems to not have a problem at all, but my Viggo RSS reader on my phone, duplicates the posts.

mrcnet
Registered User
Posts: 3
Joined: Mon Dec 17, 2007 5:43 pm

Re: [BETA] simple syndication

Post by mrcnet » Sun Dec 23, 2007 5:24 pm

can anyone post the correct code to show all topics to all forums?

mbradford
Registered User
Posts: 14
Joined: Thu Jun 15, 2006 7:17 pm

Adding a line of space (or a line) between postings

Post by mbradford » Mon Dec 24, 2007 11:59 pm

I added a post about five posts up... and am still wondering if there something that can be changed in this mod to add either a line or a line of space between posts (or both).

I'm wondering if everyone who uses this mod is having this same problem ,or if mine is just setup wrong - because this seems like it screws up the whole thing, when the posts appear to run together and there's no space between the last line of one post and the title line of the next post.

Does anyone know how to fix this?

User avatar
PatPatten
Registered User
Posts: 56
Joined: Thu Dec 07, 2006 10:29 pm
Location: Sittard - Netherlands
Contact:

Re: [BETA] simple syndication

Post by PatPatten » Fri Dec 28, 2007 11:07 am

When the feed is running on your site also go here to check the validation:

http://feedvalidator.org/

Otherwise the feed looks ok in FF and/or IE but feedreaders programs gives errors on the feed.

Most of my members use feedreaders for rss/atom instead of the default built-in browser ones.

http://www.google.com/search?client=ope ... 8&oe=utf-8

-Patricia
StarTrekGuide Forum Moderation Team Member
phpBB3 MODs and Styles Development - Olympus MOD Database - phpBB programming Academy

Tom Keels
Registered User
Posts: 30
Joined: Wed Jun 05, 2002 2:29 pm

Re: [BETA] simple syndication

Post by Tom Keels » Fri Dec 28, 2007 3:50 pm

Even though there are some minor errors in my feed according to FeedValidator, and my feed technically doesn't validate, my feed works great in all the readers/aggs that I have used.

One thing I have noticed this mod does not take into consideration is the timezone of the board. The times are coming through like this

<pubDate>Fri, 28 Dec 2007 07:06:24 -0800</pubDate>

When it should be -0500.

Colin Kaminski
Registered User
Posts: 55
Joined: Wed Jun 09, 2004 4:06 pm
Contact:

Re: [BETA] simple syndication

Post by Colin Kaminski » Tue Jan 01, 2008 2:08 am

OK Thank you to everyones posts I have this working like I think it should. Provides 20 posts. Links to the latest post and lists the post titles not the topic titles. It also does not use session Ids so it only returns posts once. It fails validation because of the <br> tags but I don't know how to fix that. Note: None of this code is my own it all apears in posts above.

Code: Select all

<?php
/*
*
* @package phpBB3
* @version $Id: syndication.php,v 1.0 2006/11/27 22:29:16 angelside Exp $
* Modified by CK for holographyforum.org
* @copyright (c) Canver Software
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// Begin configuration
$CFG['exclude_forums'] 	= '';
$CFG['max_topics'] 		= '20';
// End configuration

// requests
$fid    = request_var('fid', '');
$count 	= request_var('count', 0);
$chars 	= request_var('chars', 200);
$type 	= request_var('type', '');
$topics_only = request_var('t', '');

// If not set, set the output count to max_topics
$count = ( $count == 0 ) ? $CFG['max_topics'] : $count;

// maximum text char limit
if($chars<0 || $chars>500) $chars=500; //Maximum

// generate url
$board_url = generate_board_url();
$index_url = $board_url . '/index.' . $phpEx;
$viewtopic_url = $board_url . '/viewtopic.' . $phpEx;


// below three function barroved on "Full Syndication Suite 0.9.4a"

/**
* parse a message
*/
function parse_message($row, $bbcode_options, $bbcode_uid, $bbcode_bitfield)
{
	global $board_url;

	$row = html_entity_decode(generate_text_for_display($row, $bbcode_uid, $bbcode_bitfield, $bbcode_options));

	// smilies contain relative URL, we need it to be absolute
	return str_replace('<img src="./', '<img src="' . $board_url . '/', $row);
}

/**
* encode message for usage with RSS
*/
function rss_prepare_message(&$message)
{
	// embed message into CDATA tags in case it contains HTML tags or entities
	if (preg_match('/<[^>]+>|&#?[\w]+;/', $message))
	{
		// replace any ]]>
		$message = str_replace(']]>', ']]>', $message);
		$message = '<![CDATA[' . $message . ']]>';
	}
}

/**
* create a date according to RFC 3339 or 822
*/
function format_date($timestamp)
{
	global $type;
	if ($type == 'atom')
	{
		// RFC 3339 for ATOM
		return date('Y-m-d\TH:i:s\Z', $timestamp);
	}
	else
	{
		// RFC 822 for RSS2
		return date('D, d M Y H:i:s O', $timestamp);
	}
}

$sql_where = '';

// only topic first post
if ($topics_only == 1) 
{
	$sql_where = 'AND p.post_id = t.topic_first_post_id';
	$sql_from = 'FROM ' . POSTS_TABLE . ' as p, ' . FORUMS_TABLE . ' as f, ' . USERS_TABLE . ' as u, ' . TOPICS_TABLE . ' as t';
}
else
{
	$sql_from = 'FROM ' . POSTS_TABLE . ' as p, ' . FORUMS_TABLE . ' as f, ' . USERS_TABLE . ' as u';
}

// Exclude forums
if ($CFG['exclude_forums'])
{
	$exclude_forums = explode(',', $CFG['exclude_forums']);
	foreach ($exclude_forums as $i => $id)
	{
		if ($id > 0)
		{
			$sql_where .= ' AND p.forum_id != ' . trim($id);
		}
	}
}

if ($fid != '')
{
	$select_forums = explode(',', $fid);
	$sql_where .= ( sizeof($select_forums)>0 ) ? ' AND f.forum_id IN (' . $fid . ')' : '';
}

// SQL posts table
$sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_text, p.bbcode_uid, p.bbcode_bitfield, p.topic_id, p.forum_id, p.post_time, f.forum_name, f.forum_desc_options, u.username
		' . $sql_from . '
		WHERE (u.user_id = p.poster_id)
		AND p.post_approved = 1
		AND (f.forum_id = p.forum_id)
		' . $sql_where . '
		ORDER BY post_time DESC';
$result = $db->sql_query_limit($sql, $count);

while( ($row = $db->sql_fetchrow($result)) )
{

	if (!$auth->acl_get('f_list', $row['forum_id']))
	{
		// if the user does not have permissions to list this forum, skip everything until next branch
		continue;
	}

	($type != 'atom') ? rss_prepare_message($row['post_text']) : '';

	$template->assign_block_vars('item', array(
		'AUTHOR'		=> $row['username'],
		'TIME'			=> format_date($row['post_time']),
		'LINK'         => "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
		'IDENTIFIER'   => "$board_url/viewtopic.$phpEx" ."?". 'f=' . $row['forum_id'] . '&t=' . $row['topic_id']."&p=".$row['post_id']."#p".$row['post_id'],
		'TITLE'			=> $row['post_subject'],
		'TEXT'			=> parse_message($row['post_text'], $row['forum_desc_options'], $row['bbcode_uid'], $row['bbcode_bitfield']),		
		)
	);	
}

if ($type == 'atom')
{
	$template->assign_var('FEED_LINK', $board_url);
	$content_type = 'application/atom+xml';
	$tpl = 'atom';
}
else
{
	$content_type = 'application/rss+xml';
	$tpl = 'rss2';
}

$template->set_filenames(array(
	'body' => 'syndication_' . $tpl . '.xml')
);

// get time, use current time
$last_build_date = mktime();

$template->assign_vars(array(
	'HEADER'		=> '<?xml version="1.0" encoding="UTF-8"?>' . "\n", // workaround for remove_php_tags() removing this line from the template
	'TITLE'			=> strip_tags($config['sitename']),
	'DESCRIPTION'	=> strip_tags($config['site_desc']),
	'LINK'			=> $board_url,
 	'LAST_BUILD'	=> format_date($last_build_date)
	)
);

// gzip compression
if ($config['gzip_compress'])
{
	if (@extension_loaded('zlib') && !headers_sent())
	{
		ob_start('ob_gzhandler');
	}
}

// start output
header ('Content-Type: ' . $content_type . '; charset=UTF-8');
$template->display('body');
exit;

?>
I included the whole code incase there are others like me with difficulty finding all the patches in this thread.

Locked

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