{REQUEST} - Topics Anywhere for phpBB 3.x.

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)
Anti-Spam Guide
dnb
Registered User
Posts: 221
Joined: Fri Sep 07, 2007 9:19 am

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by dnb »

Highway of Life wrote:
dnb wrote:Can anyone help please ?

i would like to include the forum block system into this script........

//forums you do not want to show
$forums ='256,257';

Code: Select all

    <?[...]
Don’t use that script, use a MOD instead.
The script has some rather serious issues with it.
Hi Highway of Life,

I have tried soo many recent topics mods but haven't found one that lets me call the script from the root of my website to my overall_header.html file, my overall_header file redirects to my index.php homepage.

IoanFilipov script is the first i've come by that works without using the iframe include function, i would like a mod that can use either one of the following include methods....

Code: Select all

<!-- INCLUDEPHP recent_topics.php -->

Code: Select all

<!-- INCLUDE recent_topics.php -->

Code: Select all

<?php include('topic_top.php'); ?>
which mod would you suggest i try ??
User avatar
atropak
Registered User
Posts: 8
Joined: Wed Jan 30, 2008 11:17 am

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by atropak »

Please
Is there any mod to show last post in other page - not last topic - ?
I need this mod seriously... :evil:
The Best Mobile Center
http://Www.AtroPak.Com
User avatar
ameisez
Registered User
Posts: 1166
Joined: Sun Nov 04, 2007 7:04 am

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameisez »

atropak wrote:Please
Is there any mod to show last post in other page - not last topic - ?
I need this mod seriously... :evil:
that makes 2 of us. if you find one let me know. if i find one i will let you know
PHPBB on HOSTGATOR SERVER. MY PERSONAL CHOICE ;)
Need phpBB images and buttons? HIRE ME
my MOD: BB3 Media Player | a phpbb based media player
User avatar
miaRave
Registered User
Posts: 37
Joined: Mon Apr 26, 2004 5:06 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by miaRave »

Sorry but with all due respect you're off-topic. This is a "topics" anywhere request thread.. :roll:
:: mia ::
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameeck »

Here's a version I use, its posted in a topic somewhere here, but since this topic is a request just for this:

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', 5);
    $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ý
    header('Content-Type: text/html; charset=utf-8');

    // 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><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Last Topics</title></head><body><div id="post_content"><strong>Last Topics:</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 '<li><a target="_top" href="' . $url . '">' . $row['post_subject'] . '</a> from ' . $row['username'] . ' on ' . $user->format_date($row['post_time']) . '</li>';
    }
    echo '</ul></div></body></html>';
    ?>
User avatar
withremote
Registered User
Posts: 5
Joined: Wed Jan 30, 2008 4:45 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by withremote »

Here's what i have running on http://www.moondanceevents.net/board/ in an iframe towards the bottom of the site

Code: Select all

<?php
$timer = 120;
$title = "current topics";
$gid = 120;
$url = $_SERVER['PHP_SELF'].'?id='.$gid;
?>
<html>
<head>

<?php
Echo '<META HTTP-EQUIV="Refresh" CONTENT="'.$timer.'; URL='.$url.'" />';
?>

<style type="text/css">
<!--
body {background-color:#800000; margin:0; padding:0; font-family: Verdana, Helvetica, Arial, sans-serif; color:#ffffff; font-size:10px; vertical-align:middle;}
#page-body {width=100%;}
strong {font-weight:bold;}
a {color:#ff7504; text-decoration:none;}
a:hover {color:#b741d4; border-bottom:#b741d4 solid 1px;}
ul	{display: inline; margin:0 0 0 -14px; padding:0;}
li {display: inline; list-style-type: none; padding: 0 5px 0 0;}
-->
</style>


</head>
<body>
<?php
$connection = mysql_connect(xxxx,"xxxx","xxxx") or die("Service temporarily unavailable");
$db = mysql_select_db("xxxx",$connection) or die("Service temporairly unavailable");
$sql = "select * from phpbb_topics order by topic_last_post_time desc limit 0,6";
$result = mysql_query($sql) or die("Service temporarily unavailable");

echo "<div id=\"page-body\" align=\"left\">";
echo "<ul>";
for($x=1;$x<=6;$x++){
	$row = mysql_fetch_array($result);
	echo "<li> &#8226; </li>";
	echo "<li>";
	echo "<a href = \"viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_parent\">$row[topic_title]</a>";
	echo "</li>"; 
}
echo "</ul>";
echo "</div>";
?>
</body>
</html>
The thing I can't figure out is how to point the link for the thread to the last comment in the thread. Any suggestions?
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameeck »

Try replacing this line:

Code: Select all

echo "<a href = \"viewtopic.php?f=$row[forum_id]&t=$row[topic_id]\" target = \"_parent\">$row[topic_title]</a>"; 
with this :-)

Code: Select all

echo "<a href = \"viewtopic.php?f=$row[forum_id]&t=$row[topic_id]#$row[topic_last_post_id]\" target = \"_parent\">$row[topic_title]</a>"; 
Also try to clean up your syntax, e.g. enclosing keys in arrays into appropriate quotes speeds up the script quite a bit, also you could write those echos much more legible.
User avatar
Highway of Life
Former Team Member
Posts: 6048
Joined: Wed Feb 02, 2005 5:41 pm
Location: Bend, OR
Name: David Lewis

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by Highway of Life »

In addition to ameeck's suggestions, it would be best to use the phpBB3 DBAL instead of mysql functions directly.
User avatar
plgard
Registered User
Posts: 16
Joined: Fri Apr 25, 2008 4:12 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by plgard »

Hello,

Ameeck, I'm using your code below and it works well thank you for sharing.

I see that "$forum_id = request_var('f', 0);" can select a specific forum. Can your code be modified to retrieve posts from a specific forum AND subforums?

Any AND All Help Appreciated!
Thanks in advance
Paul
<?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
$topic_limit = request_var('topic_limit', 30);

// forum_id to grab topics from (must be a valid forum_id integer)

$forums = array_unique(array_keys($auth->acl_getf('f_read', true)));

// Initial var setup
$forum_id = request_var('f', 0);
$topic_id = request_var('t', 0);
$forum_sql = empty($forum_id) ? '' : (" AND f.forum_id = '$forum_id'");
$topic_sql = empty($topic_id) ? '' : (" AND p.topic_id = t.topic_id AND t.topic_id = '$topic_id'");

// Select the last topics to which we have permissions
$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, p.post_text, p.post_time, u.username
FROM '. FORUMS_TABLE .' f,'.TOPICS_TABLE.' t, '.POSTS_TABLE.' p,'.USERS_TABLE.' u
WHERE t.forum_id = f.forum_id
AND t.topic_status != 1
AND u.user_id = p.poster_id' . $forum_sql . $topic_sql . (empty($topic_sql) ? ' AND p.post_id = t.topic_last_post_id ' : '') . '
ORDER BY ' . (empty($topic_sql) ? 't.topic_last_post_time DESC' : 'p.post_time DESC') . '
LIMIT 0,' . $topic_limit;
$result = $db->sql_query($sql);

// Proper header since output not buffered
header('Content-Type: text/html; charset=utf-8');

// Now let's output the content
echo '<div id="post_content"><ul style="list-style-type:none;">';
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 '<li><a target="_parent" href="' . $url . '">' . $row['post_subject'] . '</a></li><li>' . $row['post_text'] . '</li><br><br><li>from: ' . $row['username'] . ' on ' . $user->format_date($row['post_time']) . '</li><br>';
}
echo '</ul></div>';
?>
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameeck »

Replied to the subforum script in the separate topic:
http://www.phpbb.com/community/viewtopi ... 5#p5272375
au8ust
Translator
Posts: 11
Joined: Sun Sep 09, 2007 1:12 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by au8ust »

My phpBB3 using UTF-8 and the homepage is using UTF-8 but the fetched content from this code returned as question marks :(

Image

Any idea? Please.
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameeck »

Did you save the file in utf8?
au8ust
Translator
Posts: 11
Joined: Sun Sep 09, 2007 1:12 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by au8ust »

ameeck wrote:Did you save the file in utf8?
I tried both, same result :(
ameeck
Former Team Member
Posts: 6559
Joined: Mon Mar 21, 2005 6:57 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by ameeck »

Do you have a link? Have you tried it in a different broswer?
au8ust
Translator
Posts: 11
Joined: Sun Sep 09, 2007 1:12 pm

Re: {REQUEST} - Topics Anywhere for phpBB 3.x.

Post by au8ust »

Same on any browser. You can check at http://laobb.com/

Thanks.

Return to “[3.0.x] MOD Requests”