TinyPortal

Development => Block Codes => Topic started by: Asshandler on January 08, 2007, 05:20:46 AM

Title: Last post by?
Post by: Asshandler on January 08, 2007, 05:20:46 AM
This is the code I'm using in my PHP block to show Recent Forum Activity in our forums.  How would I add "Last Post by..." to each listing as it is by default in the normal recent activity block?
$result=ssi_recentTopics(10,array(15),'return');

echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
  echo '<Li>'.$my['link'];
  if(!$my['new'])
    echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
  echo ' ',$my['time'],'</Li>';
echo ' <hr>';
}
echo '</UL>';
echo'</center>';
echo '<span class="smalltext"></span>';


http://www.othersi.com
Title: Re: Last post by?
Post by: Lesmond on January 08, 2007, 12:22:47 PM
this is the code I use, it will give you "Last post by" at the top of the poster column.
use in a Front page Block or center block.
global $scripturl;
$what=ssi_recentTopics('10', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle" align="left">Subject</td><td valign="middle" align="left">Board</td><td valign="middle" align="center">Last Post by</td><td valign="middle" align="left">Time</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle" align="left">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['board']['link'], '</td>';
      echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" align="left">';
      if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
      echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>';
Title: Re: Last post by?
Post by: Asshandler on January 08, 2007, 03:33:17 PM
I don't want to change the table I have set up already, just would like to know what particular piece of code I'd need to add to my existing stuff to show the last post by info.
Title: Re: Last post by?
Post by: Crip on January 08, 2007, 04:03:54 PM
Asshandler --
I suggest you go change your [username] like Now!!

crip~
Title: Re: Last post by?
Post by: IchBin on January 08, 2007, 04:46:22 PM
Would be nice not to have vulgar words in usernames. We try to keep this site as family oriented as possible. Thanks!

As to your question:

I think you're looking for this code ', $topic['poster']['link'], '
Title: Re: Last post by?
Post by: Asshandler on January 08, 2007, 06:53:33 PM
I've used this username for years, came from playing online and dominating the opposition, one day a guy called me the Asshandler because of the way I handed people their butts on a platter when I faced off against them online.  It was funny because it was a typo, should have been Asshander.  Been my username ever since.  :p

Ichbin thanks for that snippet.  :)
Title: Re: Last post by?
Post by: Asshandler on January 08, 2007, 06:57:05 PM
Hmmm where exactly would that snippet of code fit in with the exisiting code?  Each place I attempt to insert it causes a parser error.
Title: Re: Last post by?
Post by: akulion on January 08, 2007, 06:58:51 PM
ooohh ok i thought u meant ass handler as in people who sell donkeys

no offence but its quite common word in my country an ass handler

so i didnt think twice of it at first
Title: Re: Last post by?
Post by: Asshandler on January 08, 2007, 07:08:05 PM
O.o I wasn't aware of the donkey meaning.  lol
Title: Re: Last post by?
Post by: IchBin on January 08, 2007, 09:30:11 PM
Post your code so we can see what you're doing. Can't tell you why you have an error if you don't do that.
Title: Re: Last post by?
Post by: Asshandler on January 08, 2007, 09:52:26 PM
$result=ssi_recentTopics(10,array(15),'return');

echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
  echo '<Li>'.$my['link'];
  if(!$my['new'])
    echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
  echo ' ',$my['time'],'</Li>';
echo ' <hr>';
}
echo '</UL>';
echo'</center>';
echo '<span class="smalltext"></span>';


Where in there should the ', $topic['poster']['link'], ' go?
Title: Re: Last post by?
Post by: Asshandler on January 09, 2007, 04:25:54 AM
Here's what I've got right now... no errors, but no username appearing either...

$result=ssi_recentTopics('10', NULL, 'array');

echo '<ul style="padding-left: 10px;">';
foreach($result as $my){
Ã,  echo '<Li>'.$my['link'];
Ã,  if(!$my['new'])
Ã,  Ã,  echo ' <a href="'.$my['href'].'"><img border="0" src="'.$settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';
echo ' <br />';
Ã,  echo ' <span class="smalltext">
',$my['time'],' by ', $topic['poster']['link'], '
</span>
</Li>';
echo ' <hr>';
}
echo '</UL>';
echo ' <div align="center"><span class="smalltext">';
ssi_whosOnline();
echo' </span></div></center>';


(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fwww.othersi.com%2Fstorage%2Frecent.jpg&hash=a2dad76b8cb06deaaf24b07600d02e7b02be21f3)

Any ideas?Ã,  I know I'm missing something, just not sure what.
Title: Re: Last post by?
Post by: Asshandler on January 09, 2007, 07:29:27 PM
Bump

I'm almost certain this is going to be a real simple thing and I'm going to feel like a fool for not seeing it.  :p
Title: Re: Last post by?
Post by: rebelrose on January 09, 2007, 07:33:40 PM
should there not be a reference to the member or something along those lines to show the member that posted  ???

if you look in your code where you have posted by there is no reference for the ssi to pull up the member that posted.
Title: Re: Last post by?
Post by: othersi on January 09, 2007, 08:45:16 PM
On a chance, looking at the code you're using Steve... I just changed your...  ', $topic['poster']['link'], ' .... code to  ...', $my['poster']['link'], ' ... and it works.
Title: Re: Last post by?
Post by: Asshandler on January 09, 2007, 10:14:54 PM
So simple... *smack*

Thank you.