collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 918
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

If you're interested in helping other members with support requests, consider joining the Community Support Helpers group.

Author Topic: Last (whatever) topics/Post  (Read 4441 times)

0 Members and 1 Guest are viewing this topic.

Offline rlake

  • Semi Newbie
  • *
  • Posts: 6
  • SMF Version: None
  • SP Version: 2.3.5
Last (whatever) topics/Post
« on: May 14, 2013, 01:48:28 PM »
Basically this is a last topics block, but you can target any section/sections you want with it. For example, I have a "for sale" category section with several boards in it. In the screenshot below, you can see I added all the boards in my "for sale" category to this block, so it would only display them.

To configure the boards that you want to display, go to the board on your website and look at what it displays in the address bar of your browser. It should display something like this...
Code: [Select]
http://yoursite.com/index.php?board=2.0Where it says board=2.0, you take the number but drop everything after the decimal point. Take that and add it to the $show variable of the script, like this...

$show = "2";

Note: To add more then one board, you have to add a comma in between each number. Example: $show = "2,3,4,5";

I also left a few settings so you can change the title text color, the time and date of the post color, and the number of post to display.

Code: [Select]
<?php
global $smcFunc$scripturl$boardurl;
$show "2,3,4,5";        // Show posts from these forums - seperate IDs with commas, eg: "2,8" 
$limit    5;          // Amount of topics to display 
$tzone    "" ;        //timezone offset in seconds - 1 Hour = 3600 Seconds
$tcolor "006633";     //Title test color
$dcolor "CC9900";     //time and date color

  
echo'<table width="100%" border="1">
<tr><td width="40%"><center><b><font color="'
.$tcolor.'">Topic Title</b></center></td>
<td width="20%"><center><b><font color="'
.$tcolor.'">Topic Starter</font></b></center></td>
<td width="10%"><center><b><font color="'
.$tcolor.'">Replies</font></b></center></td>
<td width="30%"><center><b><font color="'
.$tcolor.'">Last Action</font></b></center></td>
</tr>'
;

$dbresult $smcFunc['db_query'](''"
   SELECT id_board, id_last_msg, id_first_msg, num_replies, id_topic, id_member_started, id_member_updated
   FROM {db_prefix}topics
   WHERE id_board IN (
{$show})
   ORDER BY id_last_msg DESC
   LIMIT 
$limit "); 
while ($row $smcFunc['db_fetch_assoc']($dbresult))
{
$Replies=$row['num_replies'];
$lmess=$row['id_last_msg'];
$fmess=$row['id_first_msg'];
$topic=$row['id_topic'];
$fuserid=$row['id_member_started'];
$luserid=$row['id_member_updated'];
$boardid=$row['id_board'];

$tpresult $smcFunc['db_query'](''"
   SELECT id_board, name
   FROM {db_prefix}boards
   WHERE id_board = 
$boardid
   LIMIT 1"
);
  
while ($tp $smcFunc['db_fetch_assoc']($tpresult))
{
   $bname=$tp["name"];
}

$fpresult $smcFunc['db_query'](''"
   SELECT poster_name, subject, id_msg
   FROM {db_prefix}messages
   WHERE id_msg = 
$fmess
   LIMIT 1"
);  
while ($fp $smcFunc['db_fetch_assoc']($fpresult))
{
   $starter=$fp["poster_name"];
   $title=$fp["subject"];
}

$lpresult $smcFunc['db_query'](''"
   SELECT poster_name, subject, poster_time, id_msg
   FROM {db_prefix}messages
   WHERE id_msg = 
$lmess
   LIMIT 1"
);  
while ($lp $smcFunc['db_fetch_assoc']($lpresult))
{
   $lposter=$lp["poster_name"];
   $ptime=$lp["poster_time"];
   $ctime = ($ptime $tzone);
   $pubdate date('M jS h:i A', ($ctime));
}
 $fgrresult $smcFunc['db_query'](''"
     SELECT id_member, id_group, id_post_group
     FROM {db_prefix}members
   WHERE id_member = 
$fuserid
   LIMIT 1"
);
 while ($fgrp $smcFunc['db_fetch_assoc']($fgrresult))
  {
     if ($fgrp['id_group'] == 0)
      {
$fgroup=$fgrp['id_post_group'];
      }
else
      {
$fgroup=$fgrp['id_group'];
      }
  }
 $lgrresult $smcFunc['db_query'](''"
     SELECT id_member, id_group, id_post_group
     FROM {db_prefix}members
   WHERE id_member = 
$luserid
   LIMIT 1"
);
 while ($lgrp $smcFunc['db_fetch_assoc']($lgrresult))
  {
    if ($lgrp['id_group'] == 0)
{
  $lgroup=$lgrp['id_post_group'];
}
else
{
  $lgroup=$lgrp['id_group'];
}
  }

   $clresult $smcFunc['db_query']('''
      SELECT id_group, online_color
      FROM {db_prefix}membergroups'
);
      while ($cl $smcFunc['db_fetch_assoc']($clresult))
   {

if ($cl['id_group'] == $fgroup)
  {
   $fcolor=$cl["online_color"];
  }
if ($cl['id_group'] == $lgroup)
  {
   $lcolor=$cl["online_color"];
  }
   }


  echo'<tr><td><img src="' $boardurl .'/Themes/default/images/sp/arrow.png " /><a href="'$scripturl'?topic='$topic'.0"> '$title,'</a></td>
<td><center><a href="'
$scripturl'?action=profile;u='$fuserid'.0"> <font color="'.$fcolor.'">'$starter'</font></a></center></td>
<td><center>'
$Replies'</center></td>
<td><font color="'
.$dcolor.'"><b>'$pubdate'</b></font><br><a href="'$scripturl'?board='$boardid'.0"><b>In: </b>'$bname'</a><br><b>By: </b><a href="'$scripturl'?action=profile;u='$luserid'.0"><font color="'.$lcolor.'">'$lposter'</font></a></td>
</tr>'
;


}
  echo'</table>';

$smcFunc['db_free_result']($dbresult);


?>