Front Page News Syndication

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
Extensions Robot
Extensions Robot
Extensions Robot
Posts: 29224
Joined: Sat Aug 16, 2003 7:36 am

Front Page News Syndication

Post by Extensions Robot »

Modification name: Front Page News Syndication
Author: chAos
Modification description: Allows you to easily pull threads from a forum to display on another page as news articles. An example would be like at phpBB.com except this also pulls the text of the post (however you can use whatever part of it as you wish).
Modification version: 1.0.0
Tested on phpBB version: 3.0.4

Download file: news.zip
File size: 29.94 KiB

Modification overview page: View

The phpBB Team is not responsible nor required to provide support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB Extension Customisations Team may not be able to provide support.

-->Modification support<--
Last edited by Extensions Robot on Mon Sep 19, 2022 7:33 pm, edited 11 times in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)
Paul
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 28651
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier
Contact:

Front Page News Syndication

Post by Paul »

Modification validated/released

Notes:
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Front Page News Syndication

Post by chAos »

FAQ:
  1. How do I syndicate posts from more than one forum?

    If you're comfortable editing a bit of PHP code it should be rather straightforward to change that. I may make it easier to do this in the actual release in the future.

    If you look at line 68:

    Code: Select all

    AND t.forum_id = ".FORUM_ID." 
    That controls which forums posts are taken from. If you replace it with something along the lines of:

    Code: Select all

    AND t.forum_id IN (4,5,6)
    that should do the trick. You should be able to notice the pattern in the code above, just change the ID's to the actual ones you want, adding or removing any number of them.
    [Thanks to c0le]
  2. I get phpBB debug errors at the top of the page similar to the following

    Code: Select all

    [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /blog.php:1)
    [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /news.php:1)
    [phpBB Debug] PHP Notice: in file /includes/session.php on line 1006: Cannot modify header information - headers already sent by (output started at /news.php:1)
    [phpBB Debug] PHP Notice: in file /includes/functions.php on line 3884: Cannot modify header information - headers already sent by (output started at /news.php:1)
    The first part of the script (where it's including the phpBB files) has to be placed before you print any HTML to the page. So if you're integrating it with an existing PHP page, you should put everything upto and including line 59 at the very top of your page, then the rest of it where you actually want the news to appear.
Last edited by chAos on Sat Jul 25, 2009 1:44 am, edited 4 times in total.
User avatar
globetrotting
Registered User
Posts: 217
Joined: Thu Jan 15, 2004 8:14 pm
Location: globetrotting
Contact:

Re: Front Page News Syndication

Post by globetrotting »

Sounds great! :)

Would FPNS help to display let's say the latest 5 thread titles on a foreign html-site?
Das Sein ändert das Bewußtsein
c0le
Registered User
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Post by c0le »

Great script, exactly what i was looking for. Just one question though, how would you modify this script to show data from multiple forum id's instead of just 1?
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Post by chAos »

globetrotting wrote:Sounds great! :)

Would FPNS help to display let's say the latest 5 thread titles on a foreign html-site?
The mod will only work if it's placed on the same server as your forums. It can't pull posts from another forum.
c0le wrote:Great script, exactly what i was looking for. Just one question though, how would you modify this script to show data from multiple forum id's instead of just 1?
If you're comfortable editing a bit of PHP code it should be rather straightforward to change that.

If you look at line 68:

Code: Select all

AND t.forum_id = ".FORUM_ID." 
That controls which forums posts are taken from. If you replace it with something along the lines of:

Code: Select all

AND (t.forum_id = 5 OR t.forum_id = 3 OR t.forum_id = 16)
that should do the trick (though I haven't tried it myself). You should be able to notice the pattern in the code above, just change the ID's to the actual ones you want. If you need to add more forums just append OR t.forum_id = ## to the part before the ).
c0le
Registered User
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Post by c0le »

thank you so much!!! that worked perfectly!
fealey
Registered User
Posts: 1
Joined: Sun Jan 18, 2009 1:25 pm

Re: Front Page News Syndication

Post by fealey »

Hi There,

I'm new to PHP and new to installing modifications.

I've followed the instructions for this mod to the letter and am getting the following error:

Fatal error: Call to a member function on a non-object in /homepages/11/d262789372/htdocs/The_Gig_Tree/phpBB3/news.php on line 55

any ideas?!

Many Thanks in advance.
c0le
Registered User
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Post by c0le »

chAos wrote: If you're comfortable editing a bit of PHP code it should be rather straightforward to change that.

If you look at line 68:

Code: Select all

AND t.forum_id = ".FORUM_ID." 
That controls which forums posts are taken from. If you replace it with something along the lines of:

Code: Select all

AND (t.forum_id = 5 OR t.forum_id = 3 OR t.forum_id = 16)
that should do the trick (though I haven't tried it myself). You should be able to notice the pattern in the code above, just change the ID's to the actual ones you want. If you need to add more forums just append OR t.forum_id = ## to the part before the ).

Code: Select all

AND t.forum_id IN (4,5,6,7,8,9)
i found out you can reduce what you wrote, makes it just a lil bit easier. =)
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Post by chAos »

fealey wrote:Hi There,

I'm new to PHP and new to installing modifications.

I've followed the instructions for this mod to the letter and am getting the following error:

Fatal error: Call to a member function on a non-object in /homepages/11/d262789372/htdocs/The_Gig_Tree/phpBB3/news.php on line 55

any ideas?!

Many Thanks in advance.
Hey,

That's an unusual error. Are you sure the

Code: Select all

define('PHPBB_ROOT_PATH', './forums/');   // Path to phpBB (including trailing /)
line correctly points to your phpBB installation? If you've put news.php in the same directory, then you should set that to " ./ ".
c0le wrote:
chAos wrote: If you're comfortable editing a bit of PHP code it should be rather straightforward to change that.

If you look at line 68:

Code: Select all

AND t.forum_id = ".FORUM_ID." 
That controls which forums posts are taken from. If you replace it with something along the lines of:

Code: Select all

AND (t.forum_id = 5 OR t.forum_id = 3 OR t.forum_id = 16)
that should do the trick (though I haven't tried it myself). You should be able to notice the pattern in the code above, just change the ID's to the actual ones you want. If you need to add more forums just append OR t.forum_id = ## to the part before the ).

Code: Select all

AND t.forum_id IN (4,5,6,7,8,9)
i found out you can reduce what you wrote, makes it just a lil bit easier. =)
Cool, I'll update the FAQ post at the top.
CMCDragonkai
Registered User
Posts: 483
Joined: Sat Jun 09, 2007 11:37 pm
Location: Australia.. and other parts of the world sometimes...

Re: Front Page News Syndication

Post by CMCDragonkai »

Interesting mod release, you know me and some other developers were discussing and writing about the same thing in this thread.. I'll check out your code later on.

http://www.phpbb.com/community/viewtopi ... &start=570
Show phpbb threads as html articles. V.5.03 Thanks Erik! (This will be updated constantly as I or others contribute...) This code is to be used on external HTML page, but if you want a template version see here.

For the best PHPBB total modification to posting - bbcode, embedding... everything! Visit MSSTI's ABBC3 Modification.
ukiello
Registered User
Posts: 42
Joined: Thu Jul 12, 2007 11:00 pm

Re: Front Page News Syndication

Post by ukiello »

Great job! ;)
EnneBi - Il Nota Bene Online!
Registrati e Regalati una ricarica da 10 o 30 €!
survivalbill
Registered User
Posts: 64
Joined: Mon Dec 29, 2008 6:59 pm

Re: Front Page News Syndication

Post by survivalbill »

Got it working Yee Haa thanks a bunch been needing that for so long....
Desdenova
Registered User
Posts: 646
Joined: Sat Feb 23, 2008 7:25 pm

Re: Front Page News Syndication

Post by Desdenova »

Oh, nice. I spotted something you may want to change, though, chAos. :)

I think you may want to try changing the line regarding

Code: Select all

    AND (t.forum_id = /* forum id */)
to something that is built exactly for this, $db->sql_in_set()

All you'll need to do to get $db->sql_in_set() is just provide a simple array of ID's and it will automatically build the set of "AND var = id" bits for you, like so..

Code: Select all

        'WHERE'                => '(' . $db->sql_in_set('t.forum_id', $fora_ids) . ' AND p.post_id = t.topic_first_post_id)',
Mind you, I'm using $db->sql_build_query()'s syntax for my where clause. ;) Alter it to what you need, and define $fora_ids as the forums to pull from. (like array(3, 5, 6))
User avatar
chAos
Former Team Member
Posts: 4032
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Post by chAos »

Desdenova wrote:Oh, nice. I spotted something you may want to change, though, chAos. :)

I think you may want to try changing the line regarding

Code: Select all

    AND (t.forum_id = /* forum id */)
to something that is built exactly for this, $db->sql_in_set()

All you'll need to do to get $db->sql_in_set() is just provide a simple array of ID's and it will automatically build the set of "AND var = id" bits for you, like so..

Code: Select all

        'WHERE'                => '(' . $db->sql_in_set('t.forum_id', $fora_ids) . ' AND p.post_id = t.topic_first_post_id)',
Mind you, I'm using $db->sql_build_query()'s syntax for my where clause. ;) Alter it to what you need, and define $fora_ids as the forums to pull from. (like array(3, 5, 6))
Yeah, I'm guessing that should be used for compatability with non-mysql databases though I didn't really bother with that at the time since I had to write the query myself and I was using MySQL. When I get time I might look into using the in built methods for building queries.
Locked

Return to “[3.0.x] MOD Database Releases”