MyBB Community Forums

Full Version: navigation menu for portal
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi;

I want to use multilevel navigation for categories and forums in the sidebox of portal page. I prepared a "menu.php" file, bu I can not include it to portal.php. I used : <?php include("menu.php");?>
But it did not work.

How can I include an external php file into portal.php or index.php?

Is there any plugin that can add this kind of a menu to side box?
You need to make sure your custom page is "outputting" to a variable, as MyBB outputs everything at once through the template system. Once you've got the appropriate variable, add it to the portal template.

It's probably easier to just use a plugin however - example:
<?php

function portalmenu_info() {
	return array(
		'name'			=> 'A plugin',
		'description'	=> '',
		'website'		=> '',
		'author'		=> '',
		'authorsite'	=> '',
		'version'		=> '1.0',
		'compatibility'	=> '14*',
		'guid'			=> ''
	);
}
$plugins->add_hook('portal_start', 'portalmenu_run');
function portalmenu_run() {
 global $mything;
 $mything = 'hi from plugin';
}
Save the above as /inc/plugins/portalmenu.php and add the variable {$mything} to the portal template.
I am new at mybb. I made a php file for navigation. I want to put it in side bar. But I dont know how can I do. This is my php file. Can you help me. Thanks

<?php
$baglanti = mysql_connect ("localhost","root","");
mysql_select_db ("mybb",$baglanti);
$sorgu = mysql_query ("SELECT * FROM mybb_forums where type='c'");

?>

<div class="suckerdiv">
<ul id="suckertree1">

<?php
while ($kayit=mysql_fetch_array ($sorgu))
{
$isim =$kayit["name"];
$id=$kayit["fid"];
?>
<li><a href="forumdisplay.php?fid=<?php echo $id; ?>" target="_parent">
<p><?php echo $isim;?></a>

<?php
$sorgu2 = mysql_query ("SELECT * FROM mybb_forums where type='f' and pid='$id'");

if (MySql_num_rows($sorgu2) == 0)
echo "</li>";
else
{
echo "<ul>";
while ($kayit2=mysql_fetch_array ($sorgu2))
{
$ad =$kayit2["name"];
?>

<li><a href="forumdisplay.php?fid=<?php echo $id; ?>" target="_parent"><?php echo $ad;?></a></li>
<?php
}
?>
</ul>
</li>
<?php
}
}
?>
Is there somebody to help me, to put these codes to a plugin?