$array = ssi_boardNews(5, null, null, null, 'array');
foreach ($array as $news)
{
echo '
<table border="0" width="100%" align="center" class="ssi_table">
<tr>
<td><b>', $news['subject'], '</b></td>
</tr>
<tr>
<td>', $news['body'], '<br /><br /></td>
</tr>
</table>
<br />';
if (!$news['is_last'])
echo '
<hr width="100%" />
<br />';
}
I just installed SMFssi to use the ssi_boardNews fuction, but I can’t figure out how to chose the board or control the output.I actually have a site I’m designing that will need this same thing. I’ve gotten a test SMF forum (just using it to experiment with these snippets) setup (http://my619.com/smf) and have been playing around with the SSI snippet (see it here: http://my619.com/index.php?id=154) ... but I want to be able to feed certain categories onto certain pages of the site. For example if I have a nutrition category, I would like to be able to grab the last 5 topics from the "Nutrition" category and post those last 5 topics from the "Nutrition" category from the Forum onto my "Nutrition" category page of my website, not the last 5 topics from the entire forum. I saw that you started this question earlier AMDbuilder, but it doesn’t look like there was any resolution...were you able to figure it out?
SQL Query to get Post Body from News Topic Database.
SELECT `subject`, `body` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC
____
What To Do
1. Connect to DB - Check
2. Connect to Table - Check
3. Verify connections or error out - Check
4. Query Post Results - Check
5. Query Post Titles
6. Combine Output
7. Create Final Output for Display
____
<?php
$db_host = 'localhost'; //This is the default in most cases
$db_user = 'USER';
$db_pwd = 'PASS';
$database = 'FORUM-DATABASE'; //This needs to be your SMF Database
$table = 'smf_messages'; //This should work by default unless you changed your table prefex if so modify accordingly
if (!mysql_connect($db_host, $db_user, $db_pwd))
die("Can't connect to database");
if (!mysql_select_db($database))
die("Can't select database");
// sending query
$subject = mysql_query("SELECT `subject` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC");
if (!$subject) {
die("Failed to get Subject");
}
$body = mysql_query("SELECT `body` FROM {$table} WHERE `ID_BOARD` ='5' ORDER BY `posterTime` DESC");
if (!$body) {
die("Failed to get Body");
}
$sub = mysql_num_fields($subject);
$bod = mysql_num_fields($body);
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "
<p>
$cell
</p>
<hr class='divider' />";
echo "</tr>\n";
}
mysql_free_result($result);
?>
////////// Current SSI Customization - Target Formating //////////
<h1><img src='images/ill_title.jpg' alt='ill title' width='63' height='20' />', $news['subject'], '</h1>
<p>', $news['body'], '</p>
<hr class="divider" />
To pass parameters to the function:
change the line in the snippet SMFssi:
return $ssi(); with return $ssi($param) ;
To know the parameters, see the smf SSI.php file, for recentTopics:
function ssi_recentTopics($num_recent = 8, $exclude_boards = null, $output_method = ’echo’)
so to display 3 recent topics the call is:
[[SMFssi? &ssi=`ssi_recentTopicss` ¶m=`3`]]