Latest Posts on site home page

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
phpaaa
Registered User
Posts: 168
Joined: Sun Dec 17, 2006 11:59 am

Re: Latest Posts on site home page

Post by phpaaa » Thu Jan 15, 2009 6:26 am

and also i just found that the <marquee> code in my php doesn't work in FireFox 3.0 ... ... it keeps blinking ...

Chaos-Zero
Registered User
Posts: 55
Joined: Tue Jan 13, 2009 6:44 pm

Re: Latest Posts on site home page

Post by Chaos-Zero » Wed Jan 21, 2009 9:37 am

BTW, can i use this with wordpress?

User avatar
Zaid
Registered User
Posts: 590
Joined: Thu Nov 08, 2007 2:06 pm
Location: South Pacific Ocean

Re: Latest Posts on site home page

Post by Zaid » Tue Feb 17, 2009 7:26 am

thanks man

User avatar
ge_rpger
Registered User
Posts: 81
Joined: Sat Jul 24, 2004 2:20 pm
Location: Texas
Contact:

Re: Latest Posts on site home page

Post by ge_rpger » Wed Mar 04, 2009 4:35 pm

When I throw this onto my "extra phpBB3" page, I get the following errors.

Code: Select all

[phpBB Debug] PHP Notice: in file /newposts.php on line 5: include(./phpBB3/common.php) [function.include]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /newposts.php on line 5: include() [function.include]: Failed opening './phpBB3/common.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')
[phpBB Debug] PHP Notice: in file /newposts.php on line 6: include(./phpBB3/includes/functions_display.php) [function.include]: failed to open stream: No such file or directory
[phpBB Debug] PHP Notice: in file /newposts.php on line 6: include() [function.include]: Failed opening './phpBB3/includes/functions_display.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php')

Fatal error: Call to a member function acl() on a non-object in /home/drtfacom/public_html/phpBB3/newposts.php on line 10
I placed the code from the first post into a file named /newposts.php and then called it in my home.php with the commands

Code: Select all

<?	include("newposts.php");	?>
If I remove the common.php and functinos_display.php sections (because they are previously called for in another file, and comment out the session data I get the following error

Code: Select all

Fatal error: Call to a member function acl_getf() on a non-object in /home/drtfacom/public_html/phpBB3/newposts.php on line 22
Line 22 is

Code: Select all

	// Get forums that current user has read rights to.
	$forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
Can anyone help me?

CMCDragonkai
Registered User
Posts: 483
Joined: Sat Jun 09, 2007 11:37 pm
Location: Australia.. and other parts of the world sometimes...

Re: Latest Posts on site home page

Post by CMCDragonkai » Fri Mar 06, 2009 11:46 pm

There is something written for this already. Check my signature.
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.

KeithGeo
Registered User
Posts: 1
Joined: Thu Mar 26, 2009 4:11 pm
Location: Ireland
Contact:

Re: Latest Posts on site home page

Post by KeithGeo » Thu Mar 26, 2009 4:19 pm

Hi!

Thanks for this, was looking for something similar for ages.. i have it working perfectly..

One issue i have though is that i have some forums hidden unless your a full site member. But the posts appear in the scroll for everyone, is there anyway to stop this happening?

Thanks!

CMCDragonkai
Registered User
Posts: 483
Joined: Sat Jun 09, 2007 11:37 pm
Location: Australia.. and other parts of the world sometimes...

Re: Latest Posts on site home page

Post by CMCDragonkai » Fri Mar 27, 2009 4:08 am

Post in the actual thread for HTML threads hack.
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.

DARKSPADE
Registered User
Posts: 2
Joined: Mon Jul 27, 2009 4:12 pm

Re: Latest Posts on site home page

Post by DARKSPADE » Mon Jul 27, 2009 4:16 pm

Hi, I know this is kinda noobed but I was able to make the below code work and its everything I was looking for but how do you modify it to also show who the post is by? (the username)

Thanks!

Code: Select all

<?
        define('IN_PHPBB', true);
        $phpbb_root_path = './cavern/'; // Path to phpbb folder
        $phpEx = substr(strrchr(__FILE__, '.'), 1);
        include($phpbb_root_path . 'common.' . $phpEx);
        include($phpbb_root_path . 'includes/functions_display.' . $phpEx);

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

        // Grab user preferences
        $user->setup();
?>
     
          <?  
        /*** phpBB3 - Last Active Topics System ***/
        //Show last x topics
        define('TOPICS_LIMIT',10);

        // Create arrays
        $topics = array();
        
        // Get forums that current user has read rights to.
        $forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
        
        // Get active topics.
        $sql="SELECT *
        FROM " . TOPICS_TABLE . "
        WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . "
        ORDER BY topic_last_post_time DESC";
        $result = $db->sql_query_limit($sql,TOPICS_LIMIT);
        while ($r = $db->sql_fetchrow($result))
        {
            $topics[] = $r;
        }
       $db->sql_freeresult($result);
    ?>
    <div>
    <?
            
        foreach($topics as $t)
        {
            // Get folder img, topic status/type related information
            $topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']);
            $unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false;
            $folder_img = $folder_alt = $topic_type = '';
            topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type);
            
            // output the link
            ?>
                <img style="vertical-align: text-bottom" src="<?=$user->img($folder_img, $folder_alt, false, '', 'src');?>" title="<?=$user->lang[$folder_alt];?>" alt="<?=$user->lang[$folder_alt];?>" />
                <a href="<?=$phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&t=' . $t['topic_id'] . '&p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>"><?=html_entity_decode($t['topic_title']);?></a><br />
        <?
        }
        ?>
    </div>

jacen100
Registered User
Posts: 27
Joined: Sat Mar 28, 2009 10:31 pm

Re: Latest Posts on site home page

Post by jacen100 » Fri Aug 21, 2009 9:30 pm

[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/nimccnet/public_html/index22.html:8)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/nimccnet/public_html/index22.html:8)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 990: Cannot modify header information - headers already sent by (output started at /home/nimccnet/public_html/index22.html:8)


anyone know why im getting this error?
sorry to bring this post back up but im just testing out a new webpage design and im gettin this error with this script

DJ_SubSONiK
Registered User
Posts: 1
Joined: Wed Sep 09, 2009 9:25 am
Location: Greece, Europe
Contact:

Re: Latest Posts on site home page

Post by DJ_SubSONiK » Wed Sep 09, 2009 9:40 am

If you are NOT logged in at the forum and try to display the active topics, you get the debug info.

I was getting the same debug info and tried to turn debug info off but nothing changed, so I just "isolated" the code that generated the debug info between " <!-- " and " --> ".

The above script if modified like below works fine for me, either the user trying to read it is logged in or not.

Code: Select all


<html>
<head>
<title>phpBB3 - Last Active Topics System</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<!-- below is the isolated code that generates the debug info if the user is not logged in -->

<!--

<?php
define('IN_PHPBB', false);
$phpbb_root_path = 'forum/'; // Path to phpbb folder
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
// Grab user preferences
$user->setup();
?>

-->

</head>
<body>
<?  
/*** phpBB3 - Last Active Topics System ***/
//Show last x topics
define('TOPICS_LIMIT',5);
// Create arrays
$topics = array();
// Get forums that current user has read rights to.
$forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
// Get active topics.
$sql="SELECT *
FROM " . TOPICS_TABLE . "
WHERE topic_approved = '1' AND " . $db->sql_in_set('forum_id', $forums) . "
ORDER BY topic_last_post_time DESC";
$result = $db->sql_query_limit($sql,TOPICS_LIMIT);
while ($r = $db->sql_fetchrow($result))
{
$topics[] = $r;
}
$db->sql_freeresult($result);
?>
<?
foreach($topics as $t)
{
// Get folder img, topic status/type related information
$topic_tracking_info = get_complete_topic_tracking($t['forum_id'], $t['topic_id']);
$unread_topic = (isset($topic_tracking_info[$t['topic_id']]) && $t['topic_last_post_time'] > $topic_tracking_info[$t['topic_id']]) ? true : false;
$folder_img = $folder_alt = $topic_type = '';
topic_status($t, $t['topic_replies'], $unread_topic, $folder_img, $folder_alt, $topic_type);
// output the link
?>
<img src="<?=$user->img($folder_img, $folder_alt, false, '', 'src');?>" align="absmiddle" title="<?=$user->lang[$folder_alt];?>" alt="<?=$user->lang[$folder_alt];?>" />
<a href="<?=$phpbb_root_path . 'viewtopic.php?f=' . $t['forum_id'] . '&t=' . $t['topic_id'] . '&p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>" target="_blank"><?=html_entity_decode($t['topic_title']);?></a>
<?
}
?>
</body>
</html>


The page that displays my last 5 topics:

http://boom-bap.gr/forumtopics.php

eng-joker
Registered User
Posts: 23
Joined: Sat Jul 18, 2009 8:45 am
Location: Syria
Contact:

Re: Latest Posts on site home page

Post by eng-joker » Fri Sep 11, 2009 9:21 am

xDazedx wrote:Embraer195 you and I are on the same page.

I think that mod just lists recent topics on the forum page. I would like to put a small block on a side panel of my main site for recent posts in the forum. I had this before as a scrolling marquee. Helped bring people to the forum.
:roll: please somebody help me to do " scroling marquee to bring topics from my forum to website "

manhag
Registered User
Posts: 15
Joined: Mon Sep 14, 2009 5:01 am

Re: Latest Posts on site home page

Post by manhag » Wed Oct 14, 2009 3:13 pm

how can i add forum name in that script ?

Marmoset
Registered User
Posts: 7
Joined: Wed Sep 02, 2009 2:30 am

Re: Latest Posts on site home page

Post by Marmoset » Wed Oct 21, 2009 11:48 pm

I am using a script to show the last 5 posts on the home page but it is not rendering the proper URLs. I have tried 5 different scripts found on this board.

My PHPbb board is located on a subdomain while my homepage is located on the top level domain. I believe that "generate_board_url()" is including the top level url in the creation of the link for some reason. Is there an way to fix this?

Marmoset
Registered User
Posts: 7
Joined: Wed Sep 02, 2009 2:30 am

Re: Latest Posts on site home page

Post by Marmoset » Thu Oct 22, 2009 8:50 pm

If I am using the following code how can make sure the script is not pulling recent posts from forums marked as private in PHPbb3? I am currently using this script but it is pulling private posts.

Also is there a way to offset the timestamp? When time for each post the time is off by 2 hours because the script is pulling the server's time and not what I have set for the installation of PHPbb3.

Code: Select all

<?php

    // How Many Topics you want to display?
    $topicnumber = 10;
    // Scrolling towards up or down?
    $scroll = "up";
    // Change this to your phpBB path
    $urlPath = "/forum";

    // Database Configuration (Where your phpBB config.php file is located)
    include 'config.php';

    $table_topics = $table_prefix. "topics";
    $table_forums = $table_prefix. "forums";
    $table_posts = $table_prefix. "posts";
    $table_users = $table_prefix. "users";
    $link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
    mysql_select_db("$dbname") or die("Could not select database");

    $query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
    FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
    WHERE t.topic_id = p.topic_id AND
    f.forum_id = t.forum_id AND
    t.forum_id != 4 AND
    t.topic_status <> 2 AND
    p.post_id = t.topic_last_post_id AND
    p.poster_id = u.user_id
    ORDER BY p.post_id DESC LIMIT $topicnumber";
    $result = mysql_query($query) or die("Query failed");                           

    print "<marquee id=\"recent_topics\" behavior=\"scroll\" direction=\"$scroll\" height=\"170\" scrolldelay=\"100\" scrollamount=\"2\" onMouseOver=\"document.all.recent_topics.stop()\" onMouseOut=\"document.all.recent_topics.start()\">
    <table cellpadding='3' cellSpacing='2' width='100%'>";
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {

    echo  "<tr valign='top'><td><font face=\"Tahoma\" size=\"1\"><font color=\"#FFCC00\"><b><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_blank\">" .
    $row["topic_title"] .
    "</a></td></font></b><td><font face=\"Tahoma\" size=\"1\"><font color=\"#C0C0C0\"> by: <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_blank\">" .
    $row["username"] .
    "</td><td><font face=\"tahoma\" size=\"1\"><font color=\"#C0C0C0\">" .
    date('F j, Y, g:i a', $row["post_time"]) .
    "</td></tr></font>";
    }
    print "</table></marquee>";
    mysql_free_result($result);
    mysql_close($link);
    ?>

leegt5
Registered User
Posts: 92
Joined: Wed Jan 12, 2005 12:47 pm

Re: Latest Posts on site home page

Post by leegt5 » Sun Nov 01, 2009 3:44 pm

I am using the below which works fine... Could someone tell us how to modify it so I can select only the forums 25,1,2,29,3,4,5,6,10,11,26,15,28,18,19,20,22 are shown...

Code: Select all

<link rel="stylesheet" href="latest_posts.css">
<?
        /*** phpBB3 - Last Active Topics System ***/

        //Author: Ioan Filipov

        //Email: jonidev@gmail.com

        //Date: 04.06.2007

        //------------------------------

        //Edit these parameters:

        //MySQL server adress
        $host="localhost";

        //Username
        $user="removed";

        //Password
        $pass="removed";

        //Database
        $db="forum_new";

        //Table prefix
        $table="phpbb_";

        //Show last x topics
        $laforums="6";
      
   //Topic name length
        $tl="20";

        $link=mysql_connect($host, $user, $pass);
        $db=mysql_select_db($db);
        $query="select * from $table".topics."  WHERE topic_approved = '1' order by topic_last_post_time desc limit 0,$laforums";
        $query2="select config_name,config_value from $table".config." where config_name = 'server_name' limit 0,1";
        $result2=mysql_query($query2);
        $row2 = mysql_fetch_array($result2);
        extract($row2);
   $posts_per_page = $r3[1];
        $result=mysql_query($query);
        while ($row=mysql_fetch_array($result)) {
        extract($row);
        $date = date("g:i a", $topic_last_post_time );
       $query3="select forum_name from $table".forums." WHERE forum_id = ".$forum_id."";
       $result3=mysql_query($query3);
       $row2 = mysql_fetch_array($result3);
      if(strlen($topic_title) > $tl)
      {
      $topic_title = mb_substr($topic_title,0,$tl, 'utf-8').'...';
      }

      echo "<a href='http://".$config_value."/forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."&p=".$topic_last_post_id."#p".$topic_last_post_id."' target='_top'>".$topic_title."</a> at ".$date."<br>\n";
      }
        //-------------------------- END
        ?>

Locked

Return to “[3.0.x] MOD Requests”

Who is online

Users browsing this forum: No registered users and 12 guests