SimplePortal
Customization => Custom Coding => Topic started 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.
-
Anyone?
-
Everything is in source. Look for this code in SPortal(1-1|2).php file:
sp_recent($parameters)
You will see the whole function below.
-
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?
{
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 />' : '';
}
-
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.
-
Ok. Is there a way to have the above code pull just the topics, and not the replys in the topics.
-
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.
-
I'm back. Can someone edit what I have below so it will only take topics from board 1 instead of all of them.
<?php {
global $boarddir, $txt, $scripturl, $settings, $context;
require_once('community/SSI.php');
$limit = empty($parameters[0]) ? 5 : (int) $parameters[0];
// $type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');
$type = 'ssi_recentTopics';
$items = $type($limit, null, null, 'array');
foreach ($items as $key => $item)
echo '
<font size="1"><font color="#c8b4a9"><b>', $item['time'], '</b></font></font><br /> <a href="', $item['href'], '">', $item['subject'], '</a><br />', $key != count($items) - 1 ? '' : '';
} ?>
-
Change second instance of
null
with
1
and it should do it.
-
Didn't work.
This is what I have:
<?php {
global $boarddir, $txt, $scripturl, $settings, $context;
require_once('community/SSI.php');
$limit = empty($parameters[0]) ? 5 : (int) $parameters[0];
// $type = 'ssi_recent' . (empty($parameters[1]) ? 'Posts' : 'Topics');
$type = 'ssi_recentTopics';
$items = $type($limit, null, 1, 'array');
foreach ($items as $key => $item)
echo '
<font size="1"><font color="#c8b4a9"><b>', $item['time'], '</b></font></font><br /> <a href="', $item['href'], '">', $item['subject'], '</a><br />', $key != count($items) - 1 ? '' : '';
} ?>
-
If you are using SMF 2.0, it should work.