MyBB Community Forums

Full Version: How to hook to pagemanager?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, I am trying to create a plugin that will display all my forums and categories, but i need to display all this in the page manager page any idea how to hook to it. Please check this code and correct whatever you feel would make it better:

$plugins->add_hook("misc_start", "sitemap22");

function sitemap22()
{
    global $mybb, $sitemap, $theme, $db;
	
	$query = $db->simple_select("forums", "fid");
	
	while($row = $db->fetch_array($query))
						{
							$forumlink = get_forum_link($row['fid']);
							$sitemap_forum .= "<tr><td class=\"trow2\">$forumlink</td></tr>";
							
							$sitemap = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" class=\"tborder\">
							
							
							<tr>
				<td class=\"thead\" colspan=\"6\"><strong>Latest Threads</strong></td>
			</tr>
							
							
			{$sitemap_forum}
		</table>"; 
						}
    
}
You don't need to hook to Page Manager. Just add your PHP code as a new page there (of course modified to match Page Manager standards). Or use a global hook, assign your code to a variable and add it to any custom page.
Thanks buddy. The problem is I want to use MYBB template but PHP is not supporten on pages using MYBB template.
See here http://community.mybb.com/thread-63357-p...#pid456977
In that example the code uses the MyBB template system and php code (although the actual map stuff is quite complicated).
Looks like my code is messed up nothing is working could you please take a loot at it.
Marcus, you don't need page manager. You can make pages just with a php file and the mybb templates. It will do the header and everything.

http://community.mybb.com/thread-120138-...#pid868062

Full example there for latest posts.
OMG Lee that is so cool you really saved the day with your reply.
Thanks +1