MyBB Community Forums

Full Version: Forum Navigation on Portal?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As some of you know I am currently transitioning from phpbb to mybb.

One feature I have on phpBB with the MX Poral add-on is the forum navtigation on the portal.

You can see this on the left hand side at www.techmonkeys.co.uk, the bit that says "I need Help with" and then list all the forum sections.

Is there something similar I can add for the portal in myBB?
http://mk-portal.eu/index.php?ind=downlo...iew&iden=1

MK Portal supports MyBB Integration and it's very good. I recommend it.
hmmm but I already have the portal for mybb up and running and done a lot of work with it.

Is this not possible then with the default mybb portal?
In portal.php, add:
$forums = '<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>I need help with...</strong></td></tr><tr><td class="trow1"><ul class="forumlist">';
$query = $db->simple_select(TABLE_PREFIX."forums", "fid, name", "pid=0");
while($row = $db->fetch_array($query))
{
	$forums .= "<li><a href=\"forumdisplay.php?fid={$row['fid']}\">{$row['name']}</a></li>\n";
}
$forums .= '</ul></td></tr></table>';
Right before this line:
output_page($portal);

Then in the 'portal' template, add:
{$forums}
Below
{$welcome}
Hi Denis, thanks for the help, however it doesnt appear to be working.

I kind of understand the codee you have written, it is supposed to create a new table with all the forum names in as clickable links.

However no matter where I put the {$forums} on the portal page in templates, it doesnt make any difference to the site, nothing at all appears ?

Any ideas?

This is the code at the end of my portal.php (now named index.php and in a different dir):

$plugins->run_hooks("portal_end");

$forums = '<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>I need help with...</strong></td></tr><tr><td class="trow1"><ul class="forumlist">';
$query = $db->simple_select(TABLE_PREFIX."forums", "fid, name", "pid=0");
while($row = $db->fetch_array($query))
{
    $forums .= "<li><a href=\"forumdisplay.php?fid={$row['fid']}\">{$row['name']}</a></li>\n";
}
$forums .= '</ul></td></tr></table>'; 

output_page($portal);

and this is portal template:

<html>
<head>
<title>{$mybb->settings['bbname']}</title>
{$headerinclude}
</head>
<body>
{$header}

<table width="100%" cellspacing="0" cellpadding="{$theme['tablespace']}" border="0" align="center">
<tr><td valign="top" width="200">
{$forums}
{$welcome}
{$latestthreads}
</td>
<td>&nbsp;</td>
<td width="*" valign="top">
{$announcements}
</td>
</tr>
</table>
{$stats}
{$whosonline}
{$footer}
</body>
</html>

What have I done wrong?
Well it seems to be some problem with it actually getting the infrom the db.

If in my portal template I do this:

12 {$forums} 34

then on the site I get the number with a space in between and that's it.

Can anyone see a problem in that code?
$plugins->run_hooks("portal_end");

$forums = '<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>I need help with...</strong></td></tr><tr><td class="trow1"><ul class="forumlist">';
$query = $db->simple_select(TABLE_PREFIX."forums", "fid, name", "pid=0");
while($row = $db->fetch_array($query))
{
$forums .= "<li><a href=\"forumdisplay.php?fid={$row['fid']}\">{$row['name']}</a></li>\n";
}
$forums .= '</ul></td></tr></table>';

output_page($portal);

^^^
I think you should assign $forums' s value before evaluating template. Try to move all $forums line before line # eval("\$portal = \"".$templates->get("portal")."\";"); #
BINGO!!!!! Thank you my friend, may your camels have many humps Smile
mybbtesting Wrote:$plugins->run_hooks("portal_end");

$forums = '<table border="0" cellspacing="1" cellpadding="4" class="tborder"><tr><td class="thead"><strong>I need help with...</strong></td></tr><tr><td class="trow1"><ul class="forumlist">';
$query = $db->simple_select(TABLE_PREFIX."forums", "fid, name", "pid=0");
while($row = $db->fetch_array($query))
{
$forums .= "<li><a href=\"forumdisplay.php?fid={$row['fid']}\">{$row['name']}</a></li>\n";
}
$forums .= '</ul></td></tr></table>';

output_page($portal);

^^^
I think you should assign $forums' s value before evaluating template. Try to move all $forums line before line # eval("\$portal = \"".$templates->get("portal")."\";"); #

My brain had a 4-line hiccup that day.