[RC1] RSS bbCode

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! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

[RC1] RSS bbCode

Post by tomythius »

My first mod is ready to be validated:
RSS bbCode
It basically allows users to include the top post from an RSS feed using bbCode in a regular post.
Comments greatly apprecitated. Am considering release into the wild now...

Major update
plus a minor one too.

Now includes the source code for the script used to parse the feed. Great for tinkering with, and loads faster.
Also a few bugs squished!
:lol:
Also the URL filter has been relaxed, no need to specify acceptable file types.

MOD file: http://www.tom.whaletattoo.com/rss_v1.5.1.mod

ZIP file: http://www.tom.whaletattoo.com/rss_v1.5.1.zip
Last edited by tomythius on Wed Jun 15, 2005 12:48 pm, edited 6 times in total.
Tom says so, QED.
DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Post by DKing »

That sounds good. What would you put in the rss tags? [rrs]http://site/[/rss]?
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Pretty much

Post by tomythius »

Kinda, the full url works best though, as very few sites will have the RSS feed as the index of a folder.
Try it out on my forum if you want to.
Tom says so, QED.
User avatar
Lucas1510
Registered User
Posts: 47
Joined: Thu Sep 04, 2003 12:07 am
Location: Herne - Germany
Contact:

Post by Lucas1510 »

Hi,

I tried to install your mod, because I have a blog with rss. But when trying to edit the bbcode.php I do not find the following:

Code: Select all

#
#-----[ FIND ]---------------------------------
#
	bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]', '','');

#
#-----[ FIND ]---------------------------------
#
$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);'[/code]

Here is my bbcode.php, if you want to have a look at it: http://www.forum4winde.de/mods/upload/bbcode.phps

I am using phpBB 2.0.15 with installed Attachment-Mod (no other mod). I just looked at the install.txt from the attachment-mod, and it seems that there are no changes made to bbcode.php.

What's wrong with my bbcode.php? Can you help me, please?

Regards,

Lucas
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Try this version.

Post by tomythius »

Try this version.
I'd like to submit it to the mod database if people think it's ok.
rss_v1.1.0.mod
Tom says so, QED.
DKing
Registered User
Posts: 751
Joined: Sat Jul 03, 2004 8:38 pm

Re: Pretty much

Post by DKing »

tomythius wrote: Kinda, the full url works best though, as very few sites will have the RSS feed as the index of a folder.

I firgured that much... :p
tomythius wrote: Try it out on my forum if you want to.

Where? And what URL should I use?
-DKing
Latest phpBB Version: 2.0.21
Search For a MOD: MOD Search
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Post by tomythius »

Theres a forum for guests at the bottom of the index.
You could use the URL to the PHPBB announcements feed if you like: http://www.phpbb.com/rss.php
And the URL of my forum is http://www.tom.whaletattoo.com/talk/
Tom says so, QED.
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Bugfix

Post by tomythius »

Bugfix -> v1.1.1
I realised that rss files don't always have the xml extension.
I realised this because I alone use 3: .xml, .php and .rdf.
This release has support for these 3. Do I need to allow any others?
http://www.tom.whaletattoo.com/rss_v1.1.1.mod

Also I've moved the post created on my board earlier. It's now in Toms phpBB modifications, a forum just for you guys. :D
Tom says so, QED.
User avatar
Lucas1510
Registered User
Posts: 47
Joined: Thu Sep 04, 2003 12:07 am
Location: Herne - Germany
Contact:

Post by Lucas1510 »

there are some typos:

Code: Select all

#
#-----[ IN-LINE FIND ]---------------------------------
#
	'[img]','[/img]',

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
	,'[rss]','[/rss]'
should be

Code: Select all

#
#-----[ IN-LINE FIND ]---------------------------------
#
	'[img]','[/img]',

#
#-----[ IN-LINE AFTER, ADD ]---------------------------------
#
	'[rss]','[/rss]',
This one:

Code: Select all

#
#-----[ FIND ]---------------------------------
#
	$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);'
should be

Code: Select all

#
#-----[ FIND ]---------------------------------
#
	$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);
And this one:

Code: Select all

#
#-----[ FIND ]---------------------------------
#
	// [img]image_url_here[/img] code..
	// This one gets first-passed..
	$patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si";
	$replacements[] = $bbcode_tpl['img'];
In my (unedited/unchanged) bbcode.php it looks like this (do not know why, it's the german version from http://www.phpbb.de):

Code: Select all

    // [img]image_url_here[/img] code..
    // This one gets first-passed..
    $patterns[] = "#\[img:$uid\]([^?].*?)\[/img:$uid\]#i";
    $replacements[] = $bbcode_tpl['img'];
And I had to change this (in posting_body.tpl)

Code: Select all

<td><span class="genmed">
						  <input type="button" class="button" accesskey="r" name="addbbcode18" value="RSS" style="width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('r')" />
						  </span></td>
                        <td><span class="genmed">
                          <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')" />
                          </span></td>
to this

Code: Select all

<td><span class="genmed">
						  <input type="button" class="button" accesskey="r" name="addbbcode16" value="RSS" style="width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('r')" />
						  </span></td>
                        <td><span class="genmed">
                          <input type="button" class="button" accesskey="w" name="addbbcode18" value="URL" style="text-decoration: underline; width: 40px" onClick="bbstyle(18)" onMouseOver="helpline('w')" />
                          </span></td>
because when clicking on url-button it typed [rss][/rss] and when clicking on rss-button, it typed [.url][/.url] (without points).

Please, can you include the hmmm.. 'endings' .rss, .rss1 and .rss2 ( RSS 0.91 feed - RSS 1.0 feed - RSS 2.0 feed ), these are use by Serendipity Blog.

One little problem I have: When the XML-Feed, I include, uses ÖöÜüÄäß, these charcters get 'destroyed', what can I do?

For example:

Das Spiel heißt ?Partner-Spiel?. should look like Das Spiel heißt “Partner-Spiel”.

But great work so far, thx :) :)

Regards,

Lucas
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Corrections

Post by tomythius »

Here is the new version with all major issues addressed.
http://tom.whaletattoo.com/rss_v1.1.2.mod
I'm not sure about the special characters (ÖöÜüÄäß), might need a small correction routine. This may be a problem with the javascript though, to which we don't have access...
Thanks for your contribution.
Tom says so, QED.
User avatar
Lucas1510
Registered User
Posts: 47
Joined: Thu Sep 04, 2003 12:07 am
Location: Herne - Germany
Contact:

Post by Lucas1510 »

That's great, I'll update my board soon with your new version of the mod :D

And with the special chars: I will look, if I'll find a 'compatible' adress (http://itde.vccs.edu/rss2js/feed2js.php\?src={URL}), if so, I'll post it here, so users using öÖüÜäÄß etc. can use this instead.

Regards,

Lucas
User avatar
Lucas1510
Registered User
Posts: 47
Joined: Thu Sep 04, 2003 12:07 am
Location: Herne - Germany
Contact:

Post by Lucas1510 »

Works great, I just had to change

Code: Select all

#
#-----[ AFTER, ADD ]---------------------------------
#
	// [rss]RSS_url_here[/rss] code..
	$text = preg_replace("#\[rss\]((http|ftp|https|ftps)://)
	([^ \?&=\#\"\n\r\t<]*?(\.(xml|php|rdf|rss*)))\[/rss\]#sie", "'[rss:$uid]
	\\1' . str_replace(' ', '%20', '\\3') . '[/rss:$uid]'", $text);
to

Code: Select all

#
#-----[ AFTER, ADD ]---------------------------------
#
	// [rss]RSS_url_here[/rss] code..
	$text = preg_replace("#\[rss\]((http|ftp|https|ftps)://)
	([^ \?&=\#\"\n\r\t<]*?(\.(xml|php|rdf|rss|rss1|rss2)))\[/rss\]#sie", "'[rss:$uid]
	\\1' . str_replace(' ', '%20', '\\3') . '[/rss:$uid]'", $text);
because |rss* did not work for me :)

Is there a way to 'include' UTF-8-encoding? That's why the ÖöÜüÄäß does not show correct, I had this problem with another software I used, too...

Regards,

Lucas
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Post by tomythius »

OK, shame about rss*, would have been more elegant, but hey!
Regarding the UTF-8 encoding, it should be possible, but can you give me an URL that gets corrupted?
I'm including the source code for the javascript inclusion in the next version, so UTF could be built in alongside.
Tom says so, QED.
User avatar
Lucas1510
Registered User
Posts: 47
Joined: Thu Sep 04, 2003 12:07 am
Location: Herne - Germany
Contact:

Post by Lucas1510 »

Sure, these are the feeds my blog (german) creates:

RSS 0.91 feed
RSS 1.0 feed
RSS 2.0 feed
ATOM 0.3 feed

And here you can see how the 'pulled' feeds look:

http://board.forum4winde.de/viewtopic.php?p=2498#2498

[update] As I see (2 minutes ago), my feeds are encoded in UTF-8 - perhaps this is the problem? If so, sorry for bothering (and shame on me) :oops:

I will ask the programmer of Serendipity how to change the encoding :)

A BIG thank you for your help :) :)

- Lucas
tomythius
Registered User
Posts: 74
Joined: Sat May 28, 2005 3:05 pm
Location: Queniborough - Leicester - UK
Contact:

Post by tomythius »

I've been nosying around, and noticed that a lot of feeds use UTF-8, without any adverse effects.
I've also been playing with my new install. The feed2js source. I've stripped it down to make it light enough for installing within phpbb.
Anyway, the raw html it produces (no-js) for your feed is this. http://tom.whaletattoo.com/talk/include ... l=y&desc=1
Note all the accents are fine.
The corruption must be something to do with the JS or phpBB.

EDIT: http://tom.whaletattoo.com/test.html The JS is fine. Maybe it's something to do with how phpBB processes tags?
Tom says so, QED.
Post Reply

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