[MODDB] Front page news 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!
Scam Warning
fireryone
Registered User
Posts: 11
Joined: Sun Jun 24, 2007 9:50 am

Re: [RC1] Front page news syndication

Post by fireryone » Thu Jul 26, 2007 9:32 am

I've searched but cant seem to fix the common "header" problem:

Error:
[phpBB Debug] PHP Notice: in file /includes/session.php on line 818: Cannot modify header information - headers already sent by (output started at /home/rts/public_html/index.php:3)

Here is my unmodified session.php code @ line 818 (full page code has been checked for spaces before <?php and after ?> :

Code: Select all

		header('Set-Cookie: ' . $name_data . '; expires=' . $expire . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);
I've tried using your script within the index page and on its own page as it is now with the same error.

Code: Select all

<?php
    /******************************************************************************
    * POST SYNDICATION SCRIPT by chAos
    *
    * A very basic script that pulls threads with the first post from the database
    * and puts them into an array form so you can use them as you like.
    *
    * For use with phpBB3, freely distributable
    *
    ******************************************************************************/
	
/*	
		  echo "<table border='3'>";
		  echo "<tr>";
		  echo "<td>";
		  echo "\n\n<h3>{$m['topic_title']}<br><span class=\"postinfo\">".$user->format_date($m['topic_time'])." // <a href=\"".PHPBB_ROOT_PATH."viewtopic.php?f=".FORUM_ID."&t={$m['topic_id']}\">{$m['topic_replies']} {$comment}</a> // {$m['username']}<h3></span>\n";
          echo "<hr>";
		  echo "<p>{$message}</p>";
		  echo "</td>";
		  echo "</tr>"; 
		  echo "</table>";

    /** Notes:
    *
    * - Attachments haven't been handled properly.
    * - Starts a forum session as Guest user, taking all the default values for time, bbcode style (from theme), etc
    * - While viewing this page, users will appear to be viewing the Forum Index on viewonline.php. 
    *   This can't be helped without modifying other code which is beyond this
    *
    */


    //////////////////////////////////////
    //

    define('FORUM_ID', 2);                  // Forum ID to get data from
    define('POST_LIMIT', 10);               // How many to get
    define('PHPBB_ROOT_PATH', './forum/');      // Path to phpBB (including trailing /)

    define('PRINT_TO_SCREEN', true);         

             // If set to true, it will print the posts out
             // If set to false it will create an array $news[] with all the following info
             //
             //   'topic_id'         eg. 119
             //   
             //   'topic_time'      eg. 06 June, 07 (uses board default)
             //   'topic_replies'      eg. 26
             //   
             //   'username'         eg. chAos
             //   'topic_title'      eg. "News Post"
             //   
             //   'post_text'         eg. just the text (formatted w/ smilies, bbcode, etc)

    //
    //////////////////////////////////////

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

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

    // Grab user preferences
    $user->setup();

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid
    FROM ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TABLE." p
    WHERE u.user_id = t.topic_poster
    AND u.user_id = p.poster_id
    AND t.topic_id = p.topic_id
    AND p.post_id = t.topic_first_post_id
    AND t.forum_id = ".FORUM_ID."
    ORDER BY t.topic_time DESC";

    $result = $db->sql_query_limit($query, POST_LIMIT);
    $posts = array();
    $news = array();
    $bbcode_bitfield = '';
    $message = '';
    $poster_id = 0;

    while ($r = $db->sql_fetchrow($result))
    {
       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
       $bbcode_bitfield = $bbcode_bitfield | base64_decode($r['bbcode_bitfield']);
    }


    // Instantiate BBCode
    if ($bbcode_bitfield !== '')
    {
       $bbcode = new bbcode(base64_encode($bbcode_bitfield));
    }

    // Output the posts
    foreach($posts as $m)
    {
       $poster_id = $m['user_id'];
       
       $message = $m['post_text'];
       if($m['bbcode_bitfield'])
       {
          $bbcode->bbcode_second_pass($message, $m['bbcode_uid'], $m['bbcode_bitfield']);
       }

       $message = str_replace("\n", '<br />', $message);
       $message = smiley_text($message);

       $comment = ($m['topic_replies']==1) ? 'comment' : 'comments';
       
       if( PRINT_TO_SCREEN )
       {
          /* Output is in the following format
           *
           * <h3><span class="postinfo">date // 5 comments // poster</span>Thread Title</h3>
           * <p>First post test</p>
           *
           */
          echo "<table bordercolor='#b1b0b8' width='100%'>";
		  echo "<tr>";
		  echo "<td background='/images/postbg.jpg' bgcolor='#b1b0b8'>\n\n <div><b><a href=\"".PHPBB_ROOT_PATH."viewtopic.php?f=".FORUM_ID."&t={$m['topic_id']}\">{$m['topic_title']}</a></b><br><span class=\"postinfo\">".$user->format_date($m['topic_time'])." || {$m['topic_replies']} {$comment} || {$m['username']}</span></div>\n</td>";
		  echo "</tr>"; 
		  echo "<tr bgcolor='#b1b0b8'>";
		  echo "<td><div>{$message} <br><br> || <a href=\"".PHPBB_ROOT_PATH."posting.php?mode=reply&f=".FORUM_ID."&t={$m['topic_id']}\">Post Reply</a>||</div></td>";
		  echo "</tr>";
		  echo "</table><hr>";

       }
       else
       {
          $news[] = array(
                'topic_id' => $m['topic_id'], // eg: 119
                
                'topic_time' => $user->format_date($m['topic_time']), // eg: 06 June, 07 (uses board default)
                'topic_replies' => $m['topic_replies'], // eg: 26
                
                'username' => $m['username'], // eg: chAos
                'topic_title' => $m['topic_title'], // eg: "News Post"
                
                'post_text' => $message, // just the text         
                );
       }
       unset($message,$poster_id);
    }

?>
Let me know if I've made some stupid newbie mistake :lol:
When I log in I have no problem, the error disappears.

Weirder yet, I have two test pages up if I load one then go back reload the other there is no problem :?:

My site: http://www.rts-world.net/
which loads: http://www.rts-world.net/latest.php

My two test pages
http://www.rts-world.net/test.php
http://www.rts-world.net/bad.php

Your original script usually leaves the same error message: http://www.rts-world.net/orignal.php

If you send me somewhere I can learn to use the array let me know :D

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

Re: [RC1] Front page news syndication

Post by chAos » Thu Jul 26, 2007 9:29 pm

fireryone wrote:I've searched but cant seem to fix the common "header" problem:

Error:
[phpBB Debug] PHP Notice: in file /includes/session.php on line 818: Cannot modify header information - headers already sent by (output started at /home/rts/public_html/index.php:3)

Here is my unmodified session.php code @ line 818 (full page code has been checked for spaces before <?php and after ?> :

Code: Select all

		header('Set-Cookie: ' . $name_data . '; expires=' . $expire . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);
I've tried using your script within the index page and on its own page as it is now with the same error.

Code: Select all

<?php
    /******************************************************************************
    * POST SYNDICATION SCRIPT by chAos
    *
    * A very basic script that pulls threads with the first post from the database
    * and puts them into an array form so you can use them as you like.
    *
    * For use with phpBB3, freely distributable
    *
    ******************************************************************************/
	
/*	
		  echo "<table border='3'>";
		  echo "<tr>";
		  echo "<td>";
		  echo "\n\n<h3>{$m['topic_title']}<br><span class=\"postinfo\">".$user->format_date($m['topic_time'])." // <a href=\"".PHPBB_ROOT_PATH."viewtopic.php?f=".FORUM_ID."&t={$m['topic_id']}\">{$m['topic_replies']} {$comment}</a> // {$m['username']}<h3></span>\n";
          echo "<hr>";
		  echo "<p>{$message}</p>";
		  echo "</td>";
		  echo "</tr>"; 
		  echo "</table>";

    /** Notes:
    *
    * - Attachments haven't been handled properly.
    * - Starts a forum session as Guest user, taking all the default values for time, bbcode style (from theme), etc
    * - While viewing this page, users will appear to be viewing the Forum Index on viewonline.php. 
    *   This can't be helped without modifying other code which is beyond this
    *
    */


    //////////////////////////////////////
    //

    define('FORUM_ID', 2);                  // Forum ID to get data from
    define('POST_LIMIT', 10);               // How many to get
    define('PHPBB_ROOT_PATH', './forum/');      // Path to phpBB (including trailing /)

    define('PRINT_TO_SCREEN', true);         

             // If set to true, it will print the posts out
             // If set to false it will create an array $news[] with all the following info
             //
             //   'topic_id'         eg. 119
             //   
             //   'topic_time'      eg. 06 June, 07 (uses board default)
             //   'topic_replies'      eg. 26
             //   
             //   'username'         eg. chAos
             //   'topic_title'      eg. "News Post"
             //   
             //   'post_text'         eg. just the text (formatted w/ smilies, bbcode, etc)

    //
    //////////////////////////////////////

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

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

    // Grab user preferences
    $user->setup();

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid
    FROM ".USERS_TABLE." u, ".TOPICS_TABLE." t, ".POSTS_TABLE." p
    WHERE u.user_id = t.topic_poster
    AND u.user_id = p.poster_id
    AND t.topic_id = p.topic_id
    AND p.post_id = t.topic_first_post_id
    AND t.forum_id = ".FORUM_ID."
    ORDER BY t.topic_time DESC";

    $result = $db->sql_query_limit($query, POST_LIMIT);
    $posts = array();
    $news = array();
    $bbcode_bitfield = '';
    $message = '';
    $poster_id = 0;

    while ($r = $db->sql_fetchrow($result))
    {
       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
       $bbcode_bitfield = $bbcode_bitfield | base64_decode($r['bbcode_bitfield']);
    }


    // Instantiate BBCode
    if ($bbcode_bitfield !== '')
    {
       $bbcode = new bbcode(base64_encode($bbcode_bitfield));
    }

    // Output the posts
    foreach($posts as $m)
    {
       $poster_id = $m['user_id'];
       
       $message = $m['post_text'];
       if($m['bbcode_bitfield'])
       {
          $bbcode->bbcode_second_pass($message, $m['bbcode_uid'], $m['bbcode_bitfield']);
       }

       $message = str_replace("\n", '<br />', $message);
       $message = smiley_text($message);

       $comment = ($m['topic_replies']==1) ? 'comment' : 'comments';
       
       if( PRINT_TO_SCREEN )
       {
          /* Output is in the following format
           *
           * <h3><span class="postinfo">date // 5 comments // poster</span>Thread Title</h3>
           * <p>First post test</p>
           *
           */
          echo "<table bordercolor='#b1b0b8' width='100%'>";
		  echo "<tr>";
		  echo "<td background='/images/postbg.jpg' bgcolor='#b1b0b8'>\n\n <div><b><a href=\"".PHPBB_ROOT_PATH."viewtopic.php?f=".FORUM_ID."&t={$m['topic_id']}\">{$m['topic_title']}</a></b><br><span class=\"postinfo\">".$user->format_date($m['topic_time'])." || {$m['topic_replies']} {$comment} || {$m['username']}</span></div>\n</td>";
		  echo "</tr>"; 
		  echo "<tr bgcolor='#b1b0b8'>";
		  echo "<td><div>{$message} <br><br> || <a href=\"".PHPBB_ROOT_PATH."posting.php?mode=reply&f=".FORUM_ID."&t={$m['topic_id']}\">Post Reply</a>||</div></td>";
		  echo "</tr>";
		  echo "</table><hr>";

       }
       else
       {
          $news[] = array(
                'topic_id' => $m['topic_id'], // eg: 119
                
                'topic_time' => $user->format_date($m['topic_time']), // eg: 06 June, 07 (uses board default)
                'topic_replies' => $m['topic_replies'], // eg: 26
                
                'username' => $m['username'], // eg: chAos
                'topic_title' => $m['topic_title'], // eg: "News Post"
                
                'post_text' => $message, // just the text         
                );
       }
       unset($message,$poster_id);
    }

?>
Let me know if I've made some stupid newbie mistake :lol:
When I log in I have no problem, the error disappears.

Weirder yet, I have two test pages up if I load one then go back reload the other there is no problem :?:

My site: http://www.rts-world.net/
which loads: http://www.rts-world.net/latest.php

My two test pages
http://www.rts-world.net/test.php
http://www.rts-world.net/bad.php

Your original script usually leaves the same error message: http://www.rts-world.net/orignal.php

If you send me somewhere I can learn to use the array let me know :D
Hey fireryone,

If you're trying to implement this into an existing design, it's important that first half of the code is at the top of the code (before you start drawing things on the page).

Then the part after

Code: Select all

    // Output the posts
can be put whereever you want the posts to appear.

So you'd be looking at something like...

Code: Select all

<?php 
// first half of that code here
?>
<html>
<body>
....
<?php
// output the posts
/><
</body>
</html>
If that's not the case, then check for any spaces before or after the <?php ?> that may have slipped in.

fireryone
Registered User
Posts: 11
Joined: Sun Jun 24, 2007 9:50 am

Re: [RC1] Front page news syndication

Post by fireryone » Fri Jul 27, 2007 1:56 am

Thanks, I'll test it for a while.
Seems to be working :)

User avatar
dingclancy
Registered User
Posts: 158
Joined: Thu Oct 17, 2002 11:58 am
Contact:

Re: [RC1] Front page news syndication

Post by dingclancy » Fri Aug 10, 2007 4:30 am

Hi! I will try this!

Is it possible to put in a read full feature where after a certain limit of characters the article will be cut short....
Then a read full link will appear and that link leads to the full version of the article (I am not talking about the link to the forums). So it is kinda like a full story mode.

Thanks! :D
Lm8s Inc.
Image

User avatar
Algore
Registered User
Posts: 294
Joined: Tue Oct 24, 2006 10:19 am

Re: [RC1] Front page news syndication

Post by Algore » Fri Aug 10, 2007 10:18 am

great work ....

Hunter_wow
Registered User
Posts: 238
Joined: Wed Sep 14, 2005 11:35 pm
Location: Sweden

Re: [RC1] Front page news syndication

Post by Hunter_wow » Sun Aug 12, 2007 12:25 pm

This one look really cool. But was it possible to add:
<!-- INCLUDE overall_header.html --> and
<!-- INCLUDE overall_footer.html -->? (to the new.php)

I´m also having hard to change the look.
Tried(news.php from start to end) but dosent work:

Code: Select all

<?php
....
?>
<html>
<body bgcolor="blue">
<?php
// Output the posts
....
</body>
</html>
?>

Vinyard_X43q
Registered User
Posts: 19
Joined: Wed Jun 06, 2007 8:14 am

Re: [RC1] Front page news syndication

Post by Vinyard_X43q » Mon Oct 22, 2007 6:13 am

I really liked this syndication script. (thanks chAos) I have been using it for a while now so I though I should get attachments to work.

Here is what I came up with. If there is an easier way please post it.

Replace:

Code: Select all

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid
With

Code: Select all

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.post_attachment, p.bbcode_uid
--------------------------------------

After

Code: Select all

    $result = $db->sql_query_limit($query, POST_LIMIT);
    $posts = array();
    $news = array();
Add

Code: Select all

	$attachments = array();
	$update_count = array();
--------------------------------------

Replace

Code: Select all

       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
With

Code: Select all

       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'post_id' => $r['post_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'post_attachment' => $r['post_attachment'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
		/* Get attachments if any */	 
		if($r['post_attachment'])
		{
			$sql = "SELECT * FROM ".ATTACHMENTS_TABLE." WHERE post_msg_id = ".$r['post_id']." ORDER BY filetime DESC";
			$sql_result = $db->sql_query($sql);
			while ($a = $db->sql_fetchrow($sql_result))
			{
				$attachments[$r['post_id']][] = $a;
			}
		}
--------------------------------------

After

Code: Select all

       if($m['bbcode_bitfield'])
       {
          $bbcode->bbcode_second_pass($message, $m['bbcode_uid'], $m['bbcode_bitfield']);
       }

       $message = str_replace("\n", '<br />', $message);
       $message = smiley_text($message);
Add

Code: Select all

	   
	   if($m['post_attachment'])
	   {
	   		parse_attachments($m['forum_id'], $message, $attachments[$m['post_id']], $update_count);
	   }
Thats it. Hopefully I did not forget anything. :)

majocmatt
Registered User
Posts: 3
Joined: Tue Jul 17, 2007 2:25 am

Re: [RC1] Front page news syndication

Post by majocmatt » Wed Oct 31, 2007 11:15 pm

ecwpa wrote:great mod!

if you want to make the topic message shorter, find:

Code: Select all

       $message = str_replace("\n", '<br />', $message);
       $message = smiley_text($message);
and add this after:

Code: Select all

$varlength = strlen($message);

$limit = 600; // characters limit

if ($varlength > $limit) { 
$message = substr($message,0,$limit) . "..."; 
}
you should change $limit to any char limit you want
This is a great addition, however how do I fix the problem when someone posts a hyperlink, and it falls within the max limit allowed? In some cases, users post a URL and its parsing them as so..

Code: Select all

<a href="http://thisisatest.com/test/morete...
instead of:

Code: Select all

<a href="http://thisisatest.com/test/moretests/you=23423513">A LINK</a>
This makes everything else after this half post a link to wherever it was trying to go, and doesn't end til another </a> is found, then everything else is invalid. Any ideas on a fix?

Currently, I'm just using this

Code: Select all

 $message = str_replace("<a href=\"", '', $message);

User avatar
Shaythong
Registered User
Posts: 48
Joined: Sun May 22, 2005 1:57 am

Re: [RC1] Front page news syndication

Post by Shaythong » Sat Nov 24, 2007 2:28 am

Vinyard_X43q wrote:I really liked this syndication script. (thanks chAos) I have been using it for a while now so I though I should get attachments to work.

Here is what I came up with. If there is an easier way please post it.

Replace:

Code: Select all

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.bbcode_uid
With

Code: Select all

    $query =
    "SELECT u.user_id, u.username, t.topic_title, t.topic_poster, t.forum_id, t.topic_id, t.topic_time, t.topic_replies, t.topic_first_post_id, p.poster_id, p.topic_id, p.post_id, p.post_text, p.bbcode_bitfield, p.post_attachment, p.bbcode_uid
--------------------------------------

After

Code: Select all

    $result = $db->sql_query_limit($query, POST_LIMIT);
    $posts = array();
    $news = array();
Add

Code: Select all

	$attachments = array();
	$update_count = array();
--------------------------------------

Replace

Code: Select all

       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
With

Code: Select all

       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'post_id' => $r['post_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'post_attachment' => $r['post_attachment'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
		/* Get attachments if any */	 
		if($r['post_attachment'])
		{
			$sql = "SELECT * FROM ".ATTACHMENTS_TABLE." WHERE post_msg_id = ".$r['post_id']." ORDER BY filetime DESC";
			$sql_result = $db->sql_query($sql);
			while ($a = $db->sql_fetchrow($sql_result))
			{
				$attachments[$r['post_id']][] = $a;
			}
		}
--------------------------------------

After

Code: Select all

       if($m['bbcode_bitfield'])
       {
          $bbcode->bbcode_second_pass($message, $m['bbcode_uid'], $m['bbcode_bitfield']);
       }

       $message = str_replace("\n", '<br />', $message);
       $message = smiley_text($message);
Add

Code: Select all

	   
	   if($m['post_attachment'])
	   {
	   		parse_attachments($m['forum_id'], $message, $attachments[$m['post_id']], $update_count);
	   }
Thats it. Hopefully I did not forget anything. :)
Didn't work. Showed nothing.

In other words, the user_id call didn't work at all.

I've inserted:

Code: Select all

<a href=\"".PHPBB_ROOT_PATH."memberlist.php?mode=viewprofile&u={$m['user_id']}\">{$m['username']}</a>
It does have a user_id call but it does nothing really.

It'll just return:

Code: Select all

http://example.com/forum/memberlist.php?mode=viewprofile&u=

iamgregg
Registered User
Posts: 10
Joined: Fri Jul 06, 2007 3:52 am

Re: [RC1] Front page news syndication

Post by iamgregg » Wed Nov 28, 2007 5:53 am

I have a problem where single quotes, double quotes etc are replaced with characters like '’'.

Any idea what the problem is here?

Vinyard_X43q
Registered User
Posts: 19
Joined: Wed Jun 06, 2007 8:14 am

Re: [RC1] Front page news syndication

Post by Vinyard_X43q » Thu Nov 29, 2007 9:02 am

Shaythong wrote:Didn't work. Showed nothing.

In other words, the user_id call didn't work at all.

I've inserted:

Code: Select all

<a href=\"".PHPBB_ROOT_PATH."memberlist.php?mode=viewprofile&u={$m['user_id']}\">{$m['username']}</a>
It does have a user_id call but it does nothing really.

It'll just return:

Code: Select all

http://example.com/forum/memberlist.php?mode=viewprofile&u=
Are you saying attachments did not work? Or do you mean that your user profile links did not work?

If you were referring to the profile links then the reason it does not work is because "'user_id" was not passed to the posts array.
If you would like to get it to work just add:

Code: Select all

'user_id' => $r['user_id'],
to your posts array after your select query. Or an even more simplified way of doing this is just replace:

Code: Select all

       $posts[] = array(
             'topic_id' => $r['topic_id'],
             'post_id' => $r['post_id'],
             'topic_time' => $r['topic_time'],
             'username' => $r['username'],
             'topic_title' => $r['topic_title'],
             'post_text' => $r['post_text'],
             'post_attachment' => $r['post_attachment'],
             'bbcode_uid' => $r['bbcode_uid'],
             'bbcode_bitfield' => $r['bbcode_bitfield'],
             'topic_replies' => $r['topic_replies'],
             );
with

Code: Select all

 $posts[] = $r;

daniloff
Registered User
Posts: 12
Joined: Wed Aug 09, 2006 1:21 pm
Contact:

Re: [RC1] Front page news syndication

Post by daniloff » Sun Apr 06, 2008 9:53 pm

Is it possible to limit the feed to only one forum?

proton2112
Registered User
Posts: 19
Joined: Sun Nov 27, 2005 1:02 am

Re: [RC1] Front page news syndication

Post by proton2112 » Mon Apr 07, 2008 5:47 am

daniloff wrote:Is it possible to limit the feed to only one forum?
yes, that's what the forum id specification is for.

this script worked great for me; integrating it into my main site was very easy (but i do know php).

daniloff
Registered User
Posts: 12
Joined: Wed Aug 09, 2006 1:21 pm
Contact:

Re: [RC1] Front page news syndication

Post by daniloff » Mon Apr 07, 2008 4:54 pm

I´d like to make it restrict to only one forum. Because the mod is showing all foruns, no matter if they are normally visible or invisible to guests.

yungb
Registered User
Posts: 1
Joined: Tue Sep 09, 2008 2:22 am

Re: [RC1] Front page news syndication

Post by yungb » Tue Sep 09, 2008 2:31 am

Hey everyone. I downloaded this script and it works perfectly, except two things.

Number one, I get the "Cannot modify header information" error, only in IE. I've tried the fix posted in this thread, but it didn't seem to work.

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/session.php on line 942: Cannot modify header information - headers already sent by (output started at /.../index.php:7)
My other problem is I'm kind of a noob to both PHP and PHPBB. My question is, how do I use the news array? I try but it never works, instead, it seems the array never has a value. I do have print_to_screen set to False (I also tried 0). Still nothing. When I set it to true or 1, it works. Here is what I'm doing:

Code: Select all

echo "<h2>" . $news['topic_title'] . "</h2>";
I tried having the script in a separate file, as well as inserting it in the index file. Both are no good.

Locked

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