MyBB Community Forums

Full Version: How Can i Put Recent Topics?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How Can i Put Recent Topics on The side of my index Heres the Index

<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
<script type="text/javascript">
<!--
lang.no_new_posts = "{$lang->no_new_posts}";
lang.click_mark_read = "{$lang->click_mark_read}";
// -->
</script>
</head>
<body id="index">
{$header}

{$forums}


{myshoutbox}
{$recenttopics}

{$boardstats}

<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder" style="width: 100%;">
<tr>
<td class="thead" colspan="6">
<div><strong>Forum Status Legend</strong></div>
</td>
</tr>
</thead>
<tr>
<td class="trow1" align="center" valign="middle"><img src="{$theme['imgdir']}/on.gif" alt="{$lang->new_posts}" title="{$lang->new_posts}"/></td>
<td class="trow1" align="center" valign="middle"> <span class="smalltext">{$lang->new_posts}</span></td>
<td class="trow1" align="center" valign="middle"><img src="{$theme['imgdir']}/off.gif" alt="{$lang->no_new_posts}" title="{$lang->no_new_posts}"/></td>
<td class="trow1" align="center" valign="middle"><span class="smalltext">{$lang->no_new_posts}</span><br /></td>
<td class="trow1" align="center" valign="middle"><img src="{$theme['imgdir']}/offlock.gif" alt="{$lang->forum_locked}" title="{$lang->forum_locked}" /></td>
<td class="trow1" align="center" valign="middle"><span class="smalltext">{$lang->forum_locked}</span><br /></td>
</tr>
</table>

{$footer}
</body>
</html>
Open index.php and put in this code:
$query = $db->query("SELECT * FROM ".TABLE_PREFIX."threads ORDER BY dateline DESC LIMIT 10");
while ($thread = $db->fetch_array($query))
{
/* have it evaluate a template here and have the variable name to call it be $recenttopics making sure it is a .= instead of =*/
}

Then put whatever you want for a template for them. Use {$thread['fieldname']} to grab that field.