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
tonyfay
Registered User
Posts: 9
Joined: Thu Nov 05, 2009 12:09 pm

Re: Latest Posts on site home page

Post by tonyfay » Thu Nov 05, 2009 12:18 pm

Vinyard_X43q wrote:Here is a cleaned up version of what I use on my website.

This must be placed at the top of your page.

Code: Select all

<?
    define('IN_PHPBB', true);
    $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();
?>
 
Place this where you want the topic links to appear.

Code: Select all

 <?  
    /*** 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>
Here is a demo: [URL Removed]
Hope it's what you guys are looking for. :)
Hi All,

This Code is working for me the Only problem im having is I keep getting the [phpBB Debug] Error on lines session.php but if you vist the forum and go back to the home page it shows correctly without the Debug errors on top

I have cleared Cache, Cookies everything made sure the code was on top and in-line


Is there anyway i can get rid of this error? as the Debug error only showing for ppl that only first visited the website

I'd be greatful for any help

Thanks :)

tonyfay
Registered User
Posts: 9
Joined: Thu Nov 05, 2009 12:09 pm

Re: Latest Posts on site home page

Post by tonyfay » Thu Nov 05, 2009 5:31 pm

Anyone??

I'm really stuck on this and would love to have up and running I'd appreciate any help

Thanks

mayank646
Registered User
Posts: 76
Joined: Sat Dec 20, 2008 7:00 pm

Re: Latest Posts on site home page

Post by mayank646 » Thu Nov 05, 2009 5:42 pm

no need to do anything just install a mod named NV Recent Topics and all your problem will be solved

To see the demo visit http://www.flying-bits.org

Worked great on 3.0.5

tonyfay
Registered User
Posts: 9
Joined: Thu Nov 05, 2009 12:09 pm

Re: Latest Posts on site home page

Post by tonyfay » Thu Nov 05, 2009 5:49 pm

mayank646 wrote:no need to do anything just install a mod named NV Recent Topics and all your problem will be solved

To see the demo visit http://www.flying-bits.org

Worked great on 3.0.5
Thx for that, and the mod does look great, but i wanted to dispaly this on my main home page of my website. away from the forum,like the rest do in this topic

sry if i didn't expalin myself enough :oops:

tonyfay
Registered User
Posts: 9
Joined: Thu Nov 05, 2009 12:09 pm

Re: Latest Posts on site home page

Post by tonyfay » Thu Nov 05, 2009 6:06 pm

Hi mayank646,

Mybe if I install this mod on my forum, and then try the code i have on my website do you think the Debug will shop showing to new people that have just visisted my site for the first time?

mayank646
Registered User
Posts: 76
Joined: Sat Dec 20, 2008 7:00 pm

Re: Latest Posts on site home page

Post by mayank646 » Fri Nov 06, 2009 9:01 am

tonyfay wrote:Hi mayank646,

Mybe if I install this mod on my forum, and then try the code i have on my website do you think the Debug will shop showing to new people that have just visisted my site for the first time?
Hi tonyfay
I am new to phpbb so don't know much but you can keep a backup of your board and try the changes...

tonyfay
Registered User
Posts: 9
Joined: Thu Nov 05, 2009 12:09 pm

Re: Latest Posts on site home page

Post by tonyfay » Fri Nov 06, 2009 7:23 pm

mayank646 wrote:
tonyfay wrote:Hi mayank646,

Mybe if I install this mod on my forum, and then try the code i have on my website do you think the Debug will shop showing to new people that have just visisted my site for the first time?
Hi tonyfay
I am new to phpbb so don't know much but you can keep a backup of your board and try the changes...
Didn't work for me still getting Debug error on my main website page :?

I'd be greateful if anyone could help me on this matter, as I'm also sorta new to phpbb, is there some sort of code i'd need to stop the debug showing? or some sort of refresh code i can use that will up date the main page to the forum.

Anyone?

User avatar
betamax
Registered User
Posts: 2
Joined: Wed Apr 29, 2009 12:39 pm
Location: Prato, Italy

Re: Latest Posts on site home page

Post by betamax » Wed Feb 03, 2010 3:49 pm

Hi to everybody!
I tried to apply a latest posts module to Joomla and here it is my result.
Now I am using Joomla 1.5.15, JFusion 1.2.3-000 and phpBB 3.0.6
Looking around in the world of the Joomla extensions I couldn't find a module that could give me the latest posts following the phpBB user permissions.
I have seen that someone has already requested it for JFusion
http://code.jfusion.org/issues/287
and it will be developed in the future.

For the moment I have written something similar but I am not a php programmer and these are only snippets, that I put together, found searching the web. So I need your opinion about it and please tell me if I have made some mistake or if there are security problems.

1) Edit these 3 Joomla files
/libraries/phputf8/mbstring/case.php
/libraries/phputf8/mbstring/core.php
/libraries/phputf8/mbstring/strlen.php
put every function inside

Code: Select all

if(!function_exists('function_name')) {
}
For example, in core.php

Code: Select all

if(!function_exists('utf8_strpos')) {
    function utf8_strpos($str, $search, $offset = FALSE){
        if(strlen($str) && strlen($search)) {
            if ( $offset === FALSE ) {
                return mb_strpos($str, $search);
            } else {
                return mb_strpos($str, $search, $offset);
            }
        } else return FALSE;
    }
}
2) In /phpBB3/includes/utf/ rename utf_tools.php to inc_utf_tools.php, create in the same folder a file called utf_tools.php and inside write this

Code: Select all

<?php
if (!defined('IN_PHPBB') && !defined('JOOM15_PHPBB3'))
{
    exit;
}

//---- don't let the script be loaded more than once -----------
if(!function_exists('utf8_substr')) {
    $script_cur_path=dirname(__FILE__) . DIRECTORY_SEPARATOR;
    require($script_cur_path. "inc_utf_tools.php");       
}

if(!function_exists('utf8_strlen')) {
    $script_cur_path=dirname(__FILE__) . DIRECTORY_SEPARATOR;
    require($script_cur_path. "inc_utf_tools.php");       
}
?>
3) Edit the index.php of your Joomla template
/templates/ja_purity/index.php

and at the top of the file write

Code: Select all

<?php
global $phpbb_root_path, $phpEx, $auth, $user, $db, $config, $cache, $template;
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/'; // Path to phpbb folder
$phpEx = substr(strrchr(__FILE__, '.'), 1); // Don't remove
include($phpbb_root_path . 'common.php'); // Don't use 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.php'); // Don't use 'functions_display.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
// Grab user preferences
$user->setup();
?>
4) I created a module using Jumi and posted the following code

Code: Select all

<? 
    /*** phpBB3 - Last Active Topics System ***/
    //Show last x topics

    global $phpbb_root_path, $phpEx, $auth, $user, $db, $config, $cache;
    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="float: left; vertical-align: middle" src="<?=$user->img($folder_img, $folder_alt, false, '', 'src');?>" title="<?=$user->lang[$folder_alt];?>" alt="<?=$user->lang[$folder_alt];?>" />
            <div style="padding-left: 40px;">
                <a href="<?=JURI::base( true ) . '/index.php?option=com_jfusion&Itemid=53&jfile=viewtopic.php?f=' . $t['forum_id'] . '&t=' . $t['topic_id'] . '&p=' . $t['topic_last_post_id'] . '#p' . $t['topic_last_post_id'];?>" target="_self">
                    <?=html_entity_decode($t['topic_title']);?>
                </a>
                <br />
                <strong><?=html_entity_decode($t['topic_last_poster_name']);?></strong> -
                <? setlocale(LC_ALL, 'it_IT'); ?> <?=html_entity_decode(utf8_encode(strftime("%A %d %B %Y, %H:%M:%S",$t['topic_last_post_time']))); ?>
                [<?=html_entity_decode($t['topic_replies']);?>]
                </div>
            <br />
    <?
    }
    ?>
</div>
At line #41 change the Itemid=53 with your JFusion menu link ItemID.

Please give me any advice, suggestion or criticism.

Thank you

Spike

illusive817
Registered User
Posts: 14
Joined: Wed May 07, 2008 4:28 pm

Re: Latest Posts on site home page

Post by illusive817 » Sun Feb 14, 2010 8:28 pm

i have a template i been doing some severe reconstruction on
i dlike to display the latest 10 post on left side , i was trying some other code and , now finally found this

not sure where to put in the code or how to make the Div read it

my website is up at http://illusive817.sitefrost.com/Demise/index.html
you can see on the left top is where i want them to show up
the code i was trying to use was showing topic, post , and by who


Any help would be greatly appreciated

tonyjms2005
Registered User
Posts: 184
Joined: Fri Feb 08, 2008 6:52 pm

Re: Latest Posts on site home page

Post by tonyjms2005 » Fri Mar 05, 2010 4:33 pm

Hi
I am using this code:

Code: Select all

<?php
/** 
* newest_posts - raw dump of newest posts from forum
*
* @copyright (c) 2008 ameeck / Vojtech Vondra - phpBB.cz
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
*/
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

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

// Number of posts and grabbing permissions
// Poèet pøíspìvkù pro zobrazení a oprávnìní
$topic_limit = request_var('topic_limit', 10);
$forums = array_unique(array_keys($auth->acl_getf('f_read', true)));

// Select the last topics to which we have permissions
// Vybrat poslední témata ke kterým máme oprávnìní
$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_time, u.username
                FROM ' . POSTS_TABLE . ' p , ' . USERS_TABLE . ' u
                WHERE post_approved = 1
                    AND ' . $db->sql_in_set('forum_id', $forums) . '
                    AND u.user_id = p.poster_id
                ORDER BY post_time DESC
                LIMIT 0,' . $topic_limit;
$result = $db->sql_query($sql);

// Proper header since output not buffered
// Poslat hlavièky pro správné kódování, protože výpis obsahu je postupný


// Now let's output the content
// A teï vypsat obsah
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><BODY class=text text=#575289 vLink=#903AFF aLink=#903AFF link=#903AFF bgColor=#ffffff><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Latest Tributes</title></head><body><div id="post_content"><strong>Latest Tributes:</strong><br/><ul>';
while ($row = $db->sql_fetchrow($result))
{
    $url = generate_board_url() . "/viewtopic.{$phpEx}?f={$row['forum_id']}&t={$row['topic_id']}&p={$row['post_id']}#p{$row['post_id']}";
    echo '<img src="http://tributetothem.com/phpbb3/images/icons/misc/radioactive.gif"> <a target="_top" href="' . $url . '">' . $row['post_subject'] . '</a> from ' . $row['username']  .  '<br><br><br>';
}

echo '</ul></div></body></html>';
?>
Would it be possible to show a preview of the acutal post text? including an bbcode or attachments?

Thanks

Antony
Tribute to Them

http://tributetothem.com/phpbb3/index.php

Let their memory Live. Forever!

User avatar
jsoni
Registered User
Posts: 355
Joined: Mon Aug 02, 2010 3:55 pm
Location: Mauritius
Contact:

Re: Latest Posts on site home page

Post by jsoni » Tue Dec 21, 2010 10:43 am

Guyz I am not very much experienced but just learning... I need you frnz great help to solve this my silly issue. I have try to put on my page but I am getting some trouble with this as I don't know much how to handle HTML and PHP both into one file I have tired some cods in that one works but I want to know how to use html and php both together in one file posting below code please help me to solve it.

Code: Select all

    <?
        define('IN_PHPBB', true);
        $phpbb_root_path = './phpbb/'; // 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();
    ?>
     
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<div>
     <?  
        /*** 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>
</div>
</body>
</html>
Its rendering nothing but just only code. Please let me know where I am making a mistake.
PM me for phpbb modification
Not phpbb or php master but can help you to gain my knowledge.
On your own risk :)
For graphics and animation PM me.
Forum:http://www.pixelandgrain.in/

Rapmic
Registered User
Posts: 1
Joined: Tue Mar 08, 2011 4:21 am

Re: Latest Posts on site home page

Post by Rapmic » Tue Mar 08, 2011 4:25 am

Hi guys, can somebody help me.

I am using this code:

Code: Select all

<?
    define('IN_PHPBB', true);
    $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();
?>
 <?  
    /*** 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);
?>
<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
   ?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><BODY class=text text=#FFFFFF vLink=#C0C0C0 aLink=#FFCC99 link=#C0C0C0 bgColor="#333333"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body>
 

           <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>
</body></html>
    <?
    }
    ?>
</div>
I want it to show the name of the last user posted in the topic.

sorry for my bad english. :?

Charlie_W
Registered User
Posts: 12
Joined: Fri Jan 21, 2011 9:54 pm

Re: Latest Posts on site home page

Post by Charlie_W » Sun Mar 27, 2011 5:14 pm

I am using this code on my site:
Vinyard_X43q wrote:Here is a cleaned up version of what I use on my website.

This must be placed at the top of your page.

Code: Select all

<?
    define('IN_PHPBB', true);
    $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();
?>
 
Place this where you want the topic links to appear.

Code: Select all

 <?  
    /*** 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>
Here is a demo: [Link Removed]
Hope it's what you guys are looking for. :)
It works perfect! But I was wondering if it is possible to display the username of the author? Thanks!

User avatar
mcjambi
Registered User
Posts: 38
Joined: Fri Dec 11, 2009 3:48 pm
Contact:

Re: Latest Posts on site home page

Post by mcjambi » Sat Apr 02, 2011 2:59 am

i am finding a recent post and can be use in phpbb seo ! but nothing

cuzzmunger
Registered User
Posts: 7
Joined: Wed Sep 08, 2010 11:45 pm

Re: Latest Posts on site home page

Post by cuzzmunger » Tue Jun 21, 2011 10:34 pm

Hi,
Im using this latest posts & works great.
however my forums is on a subdomain & home page is on the main domain.

So im using a iframe to display on the home page. when I click the links it opens in the iframe...
I would just want it to open a new window/tab.
any help would be appreciated.
Vinyard_X43q wrote:Here is a cleaned up version of what I use on my website.

This must be placed at the top of your page.

Code: Select all

<?
    define('IN_PHPBB', true);
    $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();
?>
 
Place this where you want the topic links to appear.

Code: Select all

 <?  
    /*** 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>
Here is a demo: [Link Removed]
Hope it's what you guys are looking for. :)

Locked

Return to “[3.0.x] MOD Requests”

Who is online

Users browsing this forum: No registered users and 19 guests