SimplePortal

Customization => Custom Coding => Topic started by: codnerd on February 14, 2009, 10:15:57 PM

Title: Recent Side Block
Post by: codnerd on February 14, 2009, 10:15:57 PM
Basically, I am making a website that will be a HTML/PHP front page, with SMF SSI on it, and then it will be attached to the forum.

I have Simple Portal installed on my other website, and I want to know what the code for "Recent Side Block" is so I can use it on the site with the HTML/PHP front page.

I cannot give any links to the site sadly, but I can answer any questions yall may have.
Title: Re: Recent Side Block
Post by: codnerd on February 16, 2009, 05:04:40 PM
Anyone?
Title: Re: Recent Side Block
Post by: [SiNaN] on February 17, 2009, 07:47:52 AM
Everything is in source. Look for this code in SPortal(1-1|2).php file:

Code: [Select]
sp_recent($parameters)
You will see the whole function below.
Title: Re: Recent Side Block
Post by: codnerd on February 22, 2009, 11:46:07 AM
Ok. I want to put this into a PHP/HTML Webpage.

Can someone change this code real fast to make it usuable to go in any web page?

Code: [Select]
{
global $boarddir, $txt, $scripturl, $settings, $context;

require_once($boarddir . '/SSI.php');

$limit = empty($parameters[0]) ? 5 : (int) $parameters[0];
$type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');

$items = $type($limit, null, null, 'array');

foreach ($items as $key => $item)
echo '
<a href="', $item['href'], '">', $item['subject'], '</a> <span class="smalltext">', $txt[525], ' ', $item['poster']['link'], $item['new'] ? '' : ' <a href="' . $scripturl . '?topic=' . $item['topic'] . '.msg' . $item['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" /></a>', '<br />[', $item['time'], ']</span><br />', $key != count($items) - 1 ? '<hr />' : '';
}
Title: Re: Recent Side Block
Post by: [SiNaN] on February 22, 2009, 12:15:31 PM
It will work on any page. Only you should write full path to SSI instead of $boarddir for require_once() at the begining of codes.
Title: Re: Recent Side Block
Post by: codnerd on February 22, 2009, 12:36:31 PM
Ok. Is there a way to have the above code pull just the topics, and not the replys in the topics.
Title: Re: Recent Side Block
Post by: codnerd on February 22, 2009, 01:18:37 PM
I just replaced "$type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');" with "$type = 'ssi_recentTopics';" and all works.

Thank yall for yalls help. I hope this post helps people who have problems with this in the future.
Title: Re: Recent Side Block
Post by: codnerd on February 22, 2009, 03:03:24 PM
I'm back. Can someone edit what I have below so it will only take topics from board 1 instead of all of them.

Code: [Select]
<?php {
   global 
$boarddir$txt$scripturl$settings$context;

   require_once(
'community/SSI.php');

   
$limit = empty($parameters[0]) ? : (int) $parameters[0];
  
// $type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');
   
$type 'ssi_recentTopics';

   
$items $type($limitnullnull'array');

   foreach (
$items as $key => $item)
echo 
'
<font size="1"><font color="#c8b4a9"><b>'
$item['time'], '</b></font></font><br />&nbsp;&nbsp;&nbsp;<a href="'$item['href'], '">'$item['subject'], '</a><br />'$key != count($items) - '' '';
?>
Title: Re: Recent Side Block
Post by: [SiNaN] on February 22, 2009, 03:27:05 PM
Change second instance of

null

with

1

and it should do it.
Title: Re: Recent Side Block
Post by: codnerd on February 22, 2009, 03:51:24 PM
Didn't work.

This is what I have:

Code: [Select]
<?php {
   global 
$boarddir$txt$scripturl$settings$context;

   require_once(
'community/SSI.php');

   
$limit = empty($parameters[0]) ? : (int) $parameters[0];
  
// $type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');
   
$type 'ssi_recentTopics';

   
$items $type($limitnull1'array');

   foreach (
$items as $key => $item)
echo 
'
<font size="1"><font color="#c8b4a9"><b>'
$item['time'], '</b></font></font><br />&nbsp;&nbsp;&nbsp;<a href="'$item['href'], '">'$item['subject'], '</a><br />'$key != count($items) - '' '';
?>
Title: Re: Recent Side Block
Post by: [SiNaN] on February 24, 2009, 08:28:25 AM
If you are using SMF 2.0, it should work.
SimplePortal 2.3.8 © 2008-2024, SimplePortal