Code: Select all
<?
/*** phpBB3 - Last Active Topics System ***/
//Author: Ioan Filipov
//Email: [email protected]
//Date: 04.06.2007
//------------------------------
//Edit these parameters:
//MySQL server adress
$host="localhost";
//Username
$user="xxx";
//Password
$pass="xxx";
//Database
$db="xxx";
//Table prefix
$table="phpbb_";
//Show last x topics
$laforums="5";
$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);
$result=mysql_query($query);
while ($row=mysql_fetch_array($result)) {
extract($row);
$date = date("d.m.Y", $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);
echo "<a href='http://".$config_value."/forum/viewforum.php?f=".$forum_id."' target='_blank'>".$row2[forum_name].":</a> <a href='http://".$config_value."/forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."' target='_blank'>".$topic_title."</a><br> odpowiedzi: ".$topic_replies."</font>,<br>ostatni post: ".$topic_last_poster_name.",<br> dodano: ".$date."<br>\n";
}
//-------------------------- END
?>
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 = './forum/';
$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
// Pocet prspevku pro zobrazen a oprvnen
$topic_limit = request_var('topic_limit', 5);
$forums = array_unique(array_keys($auth->acl_getf('f_read', true))); //ignored in sql statement to include all topics despite permissions
// Select the last topics based on user permissions
/* $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); */
// Select the last topics ignoring permissions
// Vybrat posledn tmata ke kterm mme oprvnen
$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 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 hlavicky pro sprvn kdovn, protoe vpis obsahu je postupn
// header('Content-Type: text/html; charset=utf-8');
// Now let's output the content
// A ted 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']}"; //added fedforum to url
//old line $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="../index_pliki/dol/strzalka_niebieska.gif"> <a target="_blank" href="' . $url . '">' . $row['post_subject'] . '</a>,<br> autor: ' . ucwords($row['username']) . ',<br> data: ' . date("d.m.Y",$row['post_time']).',<br> godzina: ' . date("H:i", $row['post_time']) . ' <br>';
}
echo '</div></body></html>';
?>
Code: Select all
<?php include("forum/noweposty.php"); ?>
i still need it, if its just like topic anywhere i'm interested.scandal20 wrote:Is there still much of a demand for a clone of Topics Anywhere for phpBB 3.0.x? Seems like some people have found solutions, but others are still left in the dark because they need this functionality for .html pages. I've been looking for a project to work on in my free time so if there's enough interest I might be willing to try to port Topics Anywhere from phpBB2.
Hi ameeck,ameeck wrote: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 ...
Code: Select all
AND ' . $db->sql_in_set('forum_id', $forums) . '
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);
$phpEx = substr(strrchr(__FILE__, '.'), 1);
$phpbb_root_path = '/home/site/public_html/forums/';
include($phpbb_root_path . 'common.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
require($phpbb_root_path .'includes/functions_user.php');
// Number of posts and grabbing permissions
$topic_limit = request_var('topic_limit', 8);
// 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
$sql = 'SELECT p.post_id, p.topic_id, p.forum_id, p.post_subject, 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 border: 1px solid #734518;background-color:#F5F0D0;
//echo '<div style=""><strong></strong>';
//echo '<ul style="margin-left:0px;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']}";
$count = count(@explode($$row['post_subject']," "));
$count = strlen($row['post_subject']) - ( $count - 1 );
$subject = strlen($row['post_subject']) > 27? substr($row['post_subject'],0,24)."...": $row['post_subject'];
echo '<div style="padding-bottom:5px;"><a target="_parent" title="'.$row['post_subject'].'" href="' . $url . '">' . $subject . '</a> - ' . $row['username'] . ' : ' . date("D m/d/y, h:ia",$row['post_time']) . ' </div>';
//echo '<li>' . $row['post_text'] . '</li><br><br>';
//echo '<li style="padding-bottom:4px;text-align:right;"> </li>';
}
//echo '</ul></div>';
//echo '</ul>';
?>
Hallo,MartinWh wrote:Well thanks for this -- have now included on my forum index.page http://www.phpbb.com/rules/#rule6a
One small problem is the script is affecting the language calls below it forcing me to put it at the bottom of page and hardcoding the language calls below.
This is the code used for my lastposts section in index_body.html
and in lastpost.phpCode: Select all
<div class="forabg"> <div class="inner"><span class="corners-top"><span></span></span> <ul class="topiclist"> <li class="header"> <dl> <dt>Latest Posts</dt> </dl> </li> </ul> <ul class="forums"> <li> <dl> <dt> <!-- INCLUDEPHP lastpost.php --><br /> </dt> </dl> </li> </ul> <span class="corners-bottom"><span></span></span></div> </div>
Code: Select all
<style> a.Latp1:link,a.Latp1:active,a.Latp1:visited {font-family: verdana, arial, helvetica, sans-serif; font-size: 11px;color:#6F6F6F; font-weight: bold; text-decoration:none; line-height: 14px;} a.Latp1:hover {font-family: verdana, arial, helvetica, sans-serif; font-size: 11px;color:#B90000; font-weight: bold; text-decoration:none} a.Latp2:link,a.Latp2:active,a.Latp2:visited {font-family: verdana, arial, helvetica, sans-serif; font-size: 11px;color:#0F0F0F; font-weight: bold; text-decoration:none; line-height: 14px;} a.Latp2:hover {font-family: verdana, arial, helvetica, sans-serif; font-size: 11px;color:#B90000; font-weight: bold; text-decoration:none} .Latp {font-family: verdana, arial, helvetica, sans-serif; font-size: 11px;color:#AFAFAF; font-weight: bold; text-decoration:none} </style> <? /*** phpBB3 - Last Active Topics System ***/ //Author: Ioan Filipov //Email: [email protected] //Date: 04.06.2007 //------------------------------ //Edit these parameters: //MySQL server adress $host="localhost"; //Username $user="REMOVED"; //Password $pass="REMOVED"; //Database $db="REMOVED"; //Table prefix $table="forum_"; //Show last x topics $laforums="10"; //Topic name length $tl="40"; $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("F j, Y, 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 "<TABLE width='98%' cellpadding=2 cellspacing=0 border=0 align=center><TR><TD width='15%' class=Latp><a class=Latp1 href='http://".$config_value."/a1forum/viewforum.php?f=".$forum_id."'>".$row2[forum_name].":</a></TD><TD width='35%' class=Latp><a class=Latp2 href='http://".$config_value."/a1forum/viewtopic.php?f=".$forum_id."&t=".$topic_id."&p=".$topic_last_post_id."#p".$topic_last_post_id."'>".$topic_title."</a></TD><TD width='50%' class=Latp> last poster: ".$topic_last_poster_name." on ".$date."<br /></TD></TR></TABLE>\n"; } //-------------------------- END ?>