Hi buduke,
Could you post your findings on displaying the latest posts on the main page of 4images, I'm looking to display the lastest 5 posts on my home.html page
It was a little tricky...
I first added this to my page_header.php file
//MOD SMF forum recent posts
$smf_posts = $site_template->parse_template('smf_forum_posts');
$site_template->register_vars("smf_recent_posts",$smf_posts);
unset($smf_posts);
place that code above the
//-----------------------------------------------------
//--- Set Paging Vars ---------------------------------
//-----------------------------------------------------
I then created a html file in my template folder called smf_forum_posts.html and placed this info in it...
<?php
$test=smf_api_recent_posts(4, null, "<ul>", " ", "array");
$var=0;
while ($test[$var]){
if ($var == 1 || $var == 3){
print '<tr><td align="center" class="imagerow1"><font class="Forum">';
}
else {
print '<tr><td align="center" class="imagerow2"><font class="Forum">';
}
print '<b>'.$test[$var][short_subject].'</b><br> by '.$test[$var][poster][name].'<br> in '.$test[$var][board][name].'<br>';
$var = $var+1;
print '</font></td></tr>';
}
unset($test);
flush();
?>
and then anywhere in my templates I wanted to call the recent posts I placed...
{smf_recent_posts}
looking at the line $test=smf_api_recent_posts(4, null, "<ul>", " ", "array");
The number 4 is how many posts you want it to return,
the null is catagories that you do not want anyone to see,
the "<ul>" and the " " are seperators in the data,
and the last one can be "array" or "echo".
What I did was place a print_r($test);break; in the above code to print our and see what variables I had to work with...
hope that is enough to get you going...
PS: you need to be using the smf_api_2.zip files in order for this to work.
You can do the same thing with the SSI.php file in the forums but have not tried it to see how well it works.