Page 1 of 4

Multiple Recent topics blocks

PostPosted: Sun Aug 06, 2006 4:42 pm
Author: Adrian Rea
I have searched around but cannot find this. I thought some have done it before. Is it possible to make several recent topic blocks and have them display the recent topics of specified forums?

A

Re: Multiple Recent topics blocks

PostPosted: Sun Aug 06, 2006 5:37 pm
Author: Drop-Forged
I had something similar running between two separate sites, each site had its own recent topics and a recent topic block from the other site.

Worked good, except it confused some people, and had a little issue with sessions sometimes becuse the sitename was diferant.

Put that was 2 different boards,

Are you looking for multiple topic blocks on the same board???


That wuold be cool if we could just have it call on the forums we wanted them to.

Re: Multiple Recent topics blocks

PostPosted: Sat Aug 12, 2006 6:06 am
Author: billsatx
Adrian..is this what you mean??

Goes in the phpBB2/blocks directory

blocks_imp_recent_topics2.cfg
Code: Select all
<?php/***************************************************************************  *                       blocks_imp_recent_topics.cfg  *                            -------------------  *   begin                ]http]  *   email                : [url=http://www.integramod.com]http://www.integramod.com[/url]  *   email                : <a>webmaster@integramod.com</a>  *  *   note: removing the original copyright is illegal even you have modified  *         the code.  Just append yours if you have modified it.  ***************************************************************************/  /***************************************************************************  *  *   This program is free software; you can redistribute it and/or modify  *   it under the terms of the GNU General Public License as published by  *   the Free Software Foundation; either version 2 of the License, or  *   (at your option) any later version.  *  ***************************************************************************/  if ( !defined('IN_PHPBB') ){         die("Hacking attempt");}  if(!function_exists(imp_recent_topics2_block_func)){         function imp_recent_topics2_block_func()         {                 global $template, $portal_config, $userdata, $board_config, $db, $phpEx, $var_cache, $lang;                   $forum_data = array();                 if($portal_config['cache_enabled'])                 {                         $forum_data = $var_cache->get('forum', 90000, 'forum');                 }                 if(!$forum_data)                 {                         $sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";                         if (!$result1 = $db->sql_query($sql))                         {                                 message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);                         }                         while( $row1 = $db->sql_fetchrow($result1) )                         {                                 $forum_data[] = $row1;                         }                         if($portal_config['cache_enabled'])                         {                                 $var_cache->save($forum_data, 'forum', 'forum');                         }                 }                   $is_auth_ary = array();                 $is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);                   if( $portal_config['md_except_forum_id2'] == '' )                 {                         $except_forum_id = ''start'';                 }                 else                 {                         $except_forum_id = $portal_config['md_except_forum_id2'];                 }                   for ($i = 0; $i <count>sql_query($sql))                 {                         message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);                 }                 $number_recent_topics = $db->sql_numrows($result1);                 $recent_topic_row = array();                 while ($row1 = $db->sql_fetchrow($result1))                 {                         $recent_topic_row[] = $row1;                 }                   if($portal_config['md_recent_topics_style2']){                         $style_row = 'scroll';                 }else                 {                         $style_row = 'static';                 }                   $template->assign_block_vars($style_row,"");                   for ($i = 0; $i <number_recent_topics>assign_block_vars($style_row . '.recent_topic_row', array(                                         'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],                                         'L_TITLE' => smilies_pass($recent_topic_row[$i]['topic_title']),                                         'L_BY' => $lang['By'],                                         'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),                                         'S_POSTER' => $recent_topic_row[$i]['username'],                                         'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])                                         )                                 );                         }                         else {                                 $template->assign_block_vars($style_row . '.recent_topic_row2', array(                                         'U_TITLE' => append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'],                                         'L_TITLE' => smilies_pass($recent_topic_row[$i]['topic_title']),                                         'L_BY' => $lang['By'],                                         'U_POSTER' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $recent_topic_row[$i]['user_id']),                                         'S_POSTER' => $recent_topic_row[$i]['post_username'],                                         'S_POSTTIME' => create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])                                         )                                 );                         }                 }         }}  imp_recent_topics2_block_func();?>


Goes in the phpBB2/templates/yourtemplate/blocks/ directory
recent_topics2_block.tpl
Code: Select all
<table><tr><td><span><BEGIN><marquee><BEGIN>&raquo; <a><b>{scroll.recent_topic_row.L_TITLE}</b></a><br>by <a>{scroll.recent_topic_row.S_POSTER}</a> on {scroll.recent_topic_row.S_POSTTIME}<br><br><END></marquee><END><BEGIN><BEGIN>&raquo; <a><b>{static.recent_topic_row.L_TITLE}</b></a><br>by <a>{static.recent_topic_row.S_POSTER}</a> on {static.recent_topic_row.S_POSTTIME}<br><br><END><END></span></td></tr></table>


Then in the IM Portal config menu decide which forums for that recent topics. I have topics, topics2, topics3, topics4

Just redo above file and replace with the correct 2, 3, 4, 5 etc etc

PostPosted: Sat Aug 12, 2006 6:44 am
Author: Adrian Rea
Thanks Bill, That is exactly what I meant. [flash=,:2naniwiw]http://integramod.com/forum/images/icon/icon14.gif[/flash:2naniwiw]


A

Re: Multiple Recent topics blocks

PostPosted: Sat Aug 12, 2006 7:05 am
Author: billsatx
Just FYI...sure you know, but for others who may not be as knowledgeable...it takes more than just renaming the files 2, 3, 4 etc. Within the files there are several references to recent_topics that must be renamed recent_topics2 and so forth.

If you compare the recent_topics and recent_topics2 it pretty easy to spot the changes.

Thus just make the next set of blocks recent_topics3 and so on.

PostPosted: Sat Aug 12, 2006 7:08 am
Author: Adrian Rea
Indeed, Nice follow up. <img>

A

Re: Multiple Recent topics blocks

PostPosted: Sat Aug 12, 2006 8:17 am
Author: billsatx
Adrian...here is the link for the tutorial...

http://integramod.com/forum/kb.php?mode ... 2cab4cfbbe

I knew it was somewhere....

PostPosted: Sat Aug 12, 2006 8:28 am
Author: Adrian Rea
Well, it just goes to show that even I miss the odd item :D

Re: Multiple Recent topics blocks

PostPosted: Sat Aug 12, 2006 1:18 pm
Author: evolver
"billsatx";p="13565" wrote:Within the files there are several references to recent_topics that must be renamed recent_topics2 and so forth.

If you compare the recent_topics and recent_topics2 it pretty easy to spot the changes.

Thus just make the next set of blocks recent_topics3 and so on.

There is more to change than you did...

Every instance of recent_topic_row has to be changed as well
If you don't, you won't be able to set the right amount of topics to display in a specific block...

And I guess the same has to be done for the scroll and static (style_row), and for the except_forum_id if you want it to be different on different blocks... <img>

Re: Multiple Recent topics blocks

PostPosted: Sat Aug 12, 2006 10:04 pm
Author: billsatx
Yes, as I said referenced comparing the two recent_topics vs recent_topics2. The attachements were originally so a person could compare. After I posted the tutorial, I figured better to read that than continue with eplaining.

The example posted works on several boards I have..

Thanks

Re: Multiple Recent topics blocks

PostPosted: Mon Aug 14, 2006 4:09 pm
Author: evolver
"billsatx";p="13596" wrote:Yes, as I said referenced comparing the two recent_topics vs recent_topics2. The attachements were originally so a person could compare. After I posted the tutorial, I figured better to read that than continue with eplaining.

The example posted works on several boards I have..

Thanks

Sorry billsatx, I'm not complaining...
I have to thank you for helping us on the right way...

I'm working on a fully automated solution for this...and I have figured out how...
I will create an .exe file for cloning the recent_topics_block files with the right filenames and replaced code...
The .exe file will only ask for a name (or number) and do the rest by itself...

I will post it soon... <img> (one of the next days)

PostPosted: Tue Aug 15, 2006 4:28 am
Author: Unregistered
how abt a random picture block from a selected topic?

PostPosted: Thu Aug 17, 2006 4:34 pm
Author: evolver
"Unregistered";p="13697" wrote:how abt a random picture block from a selected topic?

I will try making more multiple blocks possible...

But for now, I have made a little tool to make it very easy with just a few mouseclicks to generate Recent_Topic_Blocks...

I hope you like it...

EDIT: I have it updated and uploaded:

Re: Multiple Recent topics blocks

PostPosted: Sun Aug 20, 2006 10:43 pm
Author: evolver
Could someone please check this out,
and place it in the downloadsection if it's OK?

Re: Multiple Recent topics blocks

PostPosted: Fri Nov 17, 2006 12:57 am
Author: computerz
"evolver";p="13879" wrote:Could someone please check this out,
and place it in the downloadsection if it's OK?


Could you draw up a text file explaining how to use it.