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.

Front Page News Syndication

Postby MOD Robot » Sat Jan 10, 2009 11:08 pm

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: See below

Download file: news.zip
File size: 30654 Bytes

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 Modifications Team may not be able to provide support.

-->Modification support<--
Last edited by MOD Robot on Wed Jun 09, 2010 4:54 pm, edited 4 times in total.
(this is a non-active account manager for the phpBB MOD Team)
MOD Robot
MOD Queue Bot
MOD Queue Bot
 
Posts: 24703
Joined: Sat Aug 16, 2003 7:36 am

Front Page News Syndication

Postby Paul » Sat Jan 10, 2009 11:08 pm

Modification validated/released

Notes:
Knock knock
Race condition
Who's there?
User avatar
Paul
MOD Team Member
MOD Team Member
 
Posts: 17565
Joined: Sat Dec 04, 2004 3:44 pm
Location: The netherlands.
Name: Paul Sohier

Front Page News Syndication

Postby chAos » Sat Jan 10, 2009 11:08 pm

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
chAos
Former Team Member
 
Posts: 4031
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Postby globetrotting » Sun Jan 11, 2009 4:00 am

Sounds great! :)

Would FPNS help to display let's say the latest 5 thread titles on a foreign html-site?
Thx for help! :)
www.worldtrip.de
globetrotting
Registered User
 
Posts: 134
Joined: Thu Jan 15, 2004 8:14 pm
Location: globetrotting

Re: Front Page News Syndication

Postby c0le » Sat Jan 17, 2009 4:24 am

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?
c0le
Registered User
 
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Postby chAos » Sat Jan 17, 2009 10:57 am

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 ).
User avatar
chAos
Former Team Member
 
Posts: 4031
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Postby c0le » Sat Jan 17, 2009 10:30 pm

thank you so much!!! that worked perfectly!
c0le
Registered User
 
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Postby fealey » Sun Jan 18, 2009 1:30 pm

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.
fealey
Registered User
 
Posts: 1
Joined: Sun Jan 18, 2009 1:25 pm

Re: Front Page News Syndication

Postby c0le » Sun Jan 18, 2009 10:09 pm

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. =)
c0le
Registered User
 
Posts: 3
Joined: Fri Jan 16, 2009 4:11 am

Re: Front Page News Syndication

Postby chAos » Mon Jan 19, 2009 2:00 am

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.
User avatar
chAos
Former Team Member
 
Posts: 4031
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Re: Front Page News Syndication

Postby CMCDragonkai » Mon Jan 19, 2009 4:08 am

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.

viewtopic.php?f=71&t=587812&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.
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

Postby ukiello » Tue Jan 20, 2009 10:48 am

Great job! ;)
EnneBi - Il Nota Bene Online!
Registrati e Regalati una ricarica da 10 o 30 €!
ukiello
Registered User
 
Posts: 42
Joined: Thu Jul 12, 2007 11:00 pm

Re: Front Page News Syndication

Postby survivalbill » Tue Jan 20, 2009 5:58 pm

Got it working Yee Haa thanks a bunch been needing that for so long....
survivalbill
Registered User
 
Posts: 64
Joined: Mon Dec 29, 2008 6:59 pm

Re: Front Page News Syndication

Postby Desdenova » Tue Jan 20, 2009 10:52 pm

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))
Desdenova
Registered User
 
Posts: 646
Joined: Sat Feb 23, 2008 7:25 pm

Re: Front Page News Syndication

Postby chAos » Wed Jan 21, 2009 3:42 am

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.
User avatar
chAos
Former Team Member
 
Posts: 4031
Joined: Wed Jan 16, 2002 7:05 am
Location: Seattle, WA, US

Next

Return to [3.0.x] MOD Database Releases

Who is online

Users browsing this forum: No registered users and 10 guests