MyBB Community Forums

Full Version: How to Integrate forums? Not Solved
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I integrate my forums with my template? Example: MyBB
There is several ways you could do this.

You could add the website header into your forums header like here on mybb which is the simplest way.
Thats not exactly what I meant... I meant like, how do I make the forums appear in the template like MyBB's? My Website <-- I allready have the "board" tab as you can see.
So you would want it where the content area is? If so the forum would be very small. Sorry if i am misunderstanding you and causing you any trouble.
I think the easiest way is to take the HTML between your site's <body> tag and the actual content, and place it in MyBB's header template.

Then take the HTML after your site's content, up to </body> and put that in MyBB's footer template.

That way, the forum will have your site's header and footer, and MyBB will appear to be nested in the content area of your layout.
EDIT: Woah, Dennis, I just saw your site. I would like mine to be like that!

Inferno, that is what I want! Except I may remove the side columns when i see what the result is. This is my progress so far. LINK

The template is messing up for some reason... Sad Anyway here is what I have in the index.html file. (I am guessing thats where I would put it.) Please correct anything that might be wrong in this! Also Dennis, I don't exactly get what you mean... Sad

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Title: Simpletex
Version 1.0
Released: 20070725
Description: A two-column, fixed-width template with light color blend.

-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JFS Designs</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
	<div id="logo">
		<h1>JFS Designs</h1>
		<h2>A Design Revolution</h2>
	</div>
	<div id="search">
		<form id="searchform" method="get" action="">
			<fieldset>
			<legend>Search</legend>
			<input id="searchinput" type="text" name="searchinput" value="" />
			<input id="searchsubmit" type="submit" value="Search" />
			</fieldset>
		</form>
	</div>
</div>
<div id="menu">
	<ul>
		<li class="active"><a href="">Home</a></li>
		<li><a href="/aboutus">About Us</a></li>
		<li><a href="/services">Services</a></li>
                <li><a href="/board">Board</a></li>
                <li><a href="/portfolio">Portfolio</a></li>
		<li><a href="/contactus">Contact Us</a></li>
	</ul>
</div>
<hr />
<div id="page">
	<div id="content">
		<div>
<?php
/**
 * MyBB 1.2
 * Copyright © 2006 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybboard.net
 * License: http://www.mybboard.net/eula.html
 *
 * $Id: index.php 3595 2008-01-09 00:10:57Z Tikitiki $
 */
define("IN_MYBB", 1);

$templatelist = "index,index_whosonline,index_welcomemembertext,index_welcomeguest,index_whosonline_memberbit,forumbit_depth1_cat,forumbit_depth1_forum,forumbit_depth2_cat,forumbit_depth2_forum,forumbit_depth1_forum_lastpost,forumbit_depth2_forum_lastpost,index_modcolumn,forumbit_moderators,forumbit_subforums,index_welcomeguesttext";
$templatelist .= ",index_birthdays_birthday,index_birthdays,index_pms,index_loginform,index_logoutlink,index_stats,forumbit_depth3,forumbit_depth3_statusicon,index_boardstats";

require_once "./global.php";

require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/functions_forumlist.php";
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

$plugins->run_hooks("index_start");

// Load global language phrases
$lang->load("index");

$logoutlink = $loginform = '';
if($mybb->user['uid'] != 0)
{
	eval("\$logoutlink = \"".$templates->get("index_logoutlink")."\";");
}
else
{
	//Checks to make sure the user can login; they haven't had too many tries at logging in.
	//Function call is not fatal
	if(login_attempt_check(false) !== false)
	{
		eval("\$loginform = \"".$templates->get("index_loginform")."\";");
	}
}
$whosonline = '';
if($mybb->settings['showwol'] != "no" && $mybb->usergroup['canviewonline'] != "no")
{
	// Get the online users.
	$timesearch = time() - $mybb->settings['wolcutoffmins']*60;
	$comma = '';
	$query = $db->query("
		SELECT s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup
		FROM ".TABLE_PREFIX."sessions s
		LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
		WHERE s.time>'$timesearch'
		ORDER BY u.username ASC, s.time DESC
	");
	$membercount = 0;
	$onlinemembers = '';
	$guestcount = 0;
	$anoncount = 0;
	$doneusers = array();

	// Loop through all users.
	while($user = $db->fetch_array($query))
	{
		// Create a key to test if this user is a search bot.
		$botkey = strtolower(str_replace("bot=", '', $user['sid']));

		// Decide what type of user we are dealing with.
		if($user['uid'] > 0)
		{
			// The user is registered.
			if($doneusers[$user['uid']] < $user['time'] || !$doneusers[$user['uid']])
			{
				// If the user is logged in anonymously, update the count for that.
				if($user['invisible'] == "yes")
				{
					++$anoncount;
				}
				++$membercount;
				if($user['invisible'] != "yes" || $mybb->usergroup['canviewwolinvis'] == "yes" || $user['uid'] == $mybb->user['uid'])
				{
					// If this usergroup can see anonymously logged-in users, mark them.
					if($user['invisible'] == "yes")
					{
						$invisiblemark = "*";
					}
					else
					{
						$invisiblemark = '';
					}

					// Properly format the username and assign the template.
					$user['username'] = format_name($user['username'], $user['usergroup'], $user['displaygroup']);
					eval("\$onlinemembers .= \"".$templates->get("index_whosonline_memberbit", 1, 0)."\";");
					$comma = ", ";
				}
				// This user has been handled.
				$doneusers[$user['uid']] = $user['time'];
			}
		}
		elseif(strstr($user['sid'], "bot=") !== false && $session->bots[$botkey])
		{
			// The user is a search bot.
			$onlinemembers .= $comma.format_name($session->bots[$botkey], $session->botgroup);
			$comma = ", ";
			++$botcount;
		}
		else
		{
			// The user is a guest.
			++$guestcount;
		}
	}

	// Build the who's online bit on the index page.
	$onlinecount = $membercount + $guestcount;
	if($onlinecount != 1)
	{
		$onlinebit = $lang->online_online_plural;
	}
	else
	{
		$onlinebit = $lang->online_online_singular;
	}
	if($membercount != 1)
	{
		$memberbit = $lang->online_member_plural;
	}
	else
	{
		$memberbit = $lang->online_member_singular;
	}
	if($anoncount != 1)
	{
		$anonbit = $lang->online_anon_plural;
	}
	else
	{
		$anonbit = $lang->online_anon_singular;
	}
	if($guestcount != 1)
	{
		$guestbit = $lang->online_guest_plural;
	}
	else
	{
		$guestbit = $lang->online_guest_singular;
	}
	$lang->online_note = sprintf($lang->online_note, my_number_format($onlinecount), $onlinebit, $mybb->settings['wolcutoffmins'], my_number_format($membercount), $memberbit, my_number_format($anoncount), $anonbit, my_number_format($guestcount), $guestbit);
	eval("\$whosonline = \"".$templates->get("index_whosonline")."\";");
}

// Build the birthdays for to show on the index page.
$bdays = $birthdays = '';
if($mybb->settings['showbirthdays'] != "no")
{
	// First, see what day this is.
	$bdaycount = 0;
	$bdaytime = time();
	$bdaydate = my_date("j-n", $bdaytime, '', 0);
	$year = my_date("Y", $bdaytime, '', 0);

	// Select all users who have their birthday today.
	$query = $db->simple_select(TABLE_PREFIX."users", "uid, username, birthday", "birthday LIKE '$bdaydate-%'");
	$comma = '';
	while($bdayuser = $db->fetch_array($query))
	{
		$bday = explode("-", $bdayuser['birthday']);
		if($year > $bday['2'] && $bday['2'] != '')
		{
			$age = " (".($year - $bday['2']).")";
		}
		else
		{
			$age = '';
		}
		eval("\$bdays .= \"".$templates->get("index_birthdays_birthday", 1, 0)."\";");
		++$bdaycount;
		$comma = ", ";
	}

	// If there are one or more birthdays, show them.
	if($bdaycount > 0)
	{
		eval("\$birthdays = \"".$templates->get("index_birthdays")."\";");
	}
}

// Build the forum statistics to show on the index page.
if($mybb->settings['showindexstats'] != "no")
{
	// First, load the stats cache.
	$stats = $cache->read("stats");

	// Check who's the newest member.
	if(!$stats['lastusername'])
	{
		$newestmember = "no-one";
	}
	else
	{
		$newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
	}

	// Format the stats language.
	$lang->stats_posts_threads = sprintf($lang->stats_posts_threads, my_number_format($stats['numposts']), my_number_format($stats['numthreads']));
	$lang->stats_numusers = sprintf($lang->stats_numusers, my_number_format($stats['numusers']));
	$lang->stats_newestuser = sprintf($lang->stats_newestuser, $newestmember);
	
	// Find out what the highest users online count is.
	$mostonline = $cache->read("mostonline");
	if($onlinecount > $mostonline['numusers'])
	{
		$time = time();
		$mostonline['numusers'] = $onlinecount;
		$mostonline['time'] = $time;
		$cache->update("mostonline", $mostonline);
	}
	$recordcount = $mostonline['numusers'];
	$recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']);
	$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);

	// Then format that language string.
	$lang->stats_mostonline = sprintf($lang->stats_mostonline, my_number_format($recordcount), $recorddate, $recordtime);

	eval("\$forumstats = \"".$templates->get("index_stats")."\";");
}

// Show the board statistics table only if one or more index statistics are enabled.
if($mybb->settings['showwol'] != "no" || $mybb->settings['showindexstats'] != "no" || ($mybb->settings['showbirthdays'] != "no" && $bdaycount > 0))
{
	eval("\$boardstats = \"".$templates->get("index_boardstats")."\";");
}

// Get the forums we will need to show.
$query = $db->simple_select(TABLE_PREFIX."forums", "*", "active != 'no'", array('order_by' => 'pid, disporder'));

// Build a forum cache.
while($forum = $db->fetch_array($query))
{
	$fcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum;

}
$forumpermissions = forum_permissions();

// Get the forum moderators if the setting is enabled.
if($mybb->settings['modlist'] != "off")
{
	$query = $db->query("
		SELECT m.uid, m.fid, u.username
		FROM ".TABLE_PREFIX."moderators m
		LEFT JOIN ".TABLE_PREFIX."users u ON (m.uid=u.uid)
		ORDER BY u.username
	");
	// Build a moderator cache.
	while($moderator = $db->fetch_array($query))
	{
		$moderatorcache[$moderator['fid']][] = $moderator;
	}
}

$excols = "index";
$permissioncache['-1'] = "1";
$bgcolor = "trow1";

// Decide if we're showing first-level subforums on the index page.
if($mybb->settings['subforumsindex'] != 0)
{
	$showdepth = 3;
}
else
{
	$showdepth = 2;
}
$forum_list = build_forumbits();
$forums = $forum_list['forum_list'];

$plugins->run_hooks("index_end");

eval("\$index = \"".$templates->get("index")."\";");
output_page($index);

?>
			</div>
			<div class="col2">
				<h2 class="title">Links</h2>
				<ul class="list">
					<li><a href="http://jfsdesigns.net/gallery">The Gallery</a></li>
			                <li><a href="http://jfsdesigns.net/advertisement">Advertisement</a></li>
					<li><a href="http://jfsdesigns.net/sales">The Store</a></li>
					<li><a href="http://sdwow.net/">Skin Deep World of Warcraft</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div id="sidebar">
		<ul>
			<li>
				<h2>News</h2>
				<ul>
					<li>
						<h3><span>1/28:</span> Template Progress</h3>
						<p>Today we started on the template you are viewing now. Progress has come far, and we are almost finished!</p>
					</li>
				</ul>
			</li>
			<li>
				<h2>Advertisement</h2>
				<ul>
				</ul>
			</li>
		</ul>
	</div>
	<div style="clear: both;">&nbsp;</div>
</div>
<hr />
<div id="footer">
	<p id="legal">Copyright &copy; 2008 JFS Designs. All Rights Reserved | Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p>
	<p id="links"><a href="">Privacy Policy</a> | <a href="">Terms of Use</a> | <a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a></p>
</div>
</body>
</html>
This is what I did. I took the index.html information from /home, cut out the middle content, and where the middle content used to be I added the index.php content there and pasted it all in the index.php file in the /board file directory. (I know this is all confusing.)

Thanks,
John
Okay you have the correct idea but incorrect implementation Toungue

The way you separated the header and footer so that MyBB's content is in the middle is correct, however, you do not put it in the actual PHP file.

Go to Admin CP --> Templates --> Modify / Delete --> *expand your template set* --> header.
Find and remove:
			<div class="logo"><a href="{$mybb->settings['bburl']}/index.php"><img src="{$theme['logo']}" alt="{$mybb->settings['bbname']}" /></a></div>
Find (it should be the first line):
	<a name="top" id="top"></a>
After that line, add your code:
<div id="header">
    <div id="logo">
        <h1>JFS Designs</h1>
        <h2>A Design Revolution</h2>
    </div>
    <div id="search">
        <form id="searchform" method="get" action="">
            <fieldset>
            <legend>Search</legend>
            <input id="searchinput" type="text" name="searchinput" value="" />
            <input id="searchsubmit" type="submit" value="Search" />
            </fieldset>
        </form>
    </div>
</div>
<div id="menu">
    <ul>
        <li class="active"><a href="">Home</a></li>
        <li><a href="/aboutus">About Us</a></li>
        <li><a href="/services">Services</a></li>
                <li><a href="/board">Board</a></li>
                <li><a href="/portfolio">Portfolio</a></li>
        <li><a href="/contactus">Contact Us</a></li>
    </ul>
</div>
<hr />
<div id="page">
    <div id="content">
        <div>

And in the footer template, at the very end of the template, paste in your code:
            </div>
            <div class="col2">
                <h2 class="title">Links</h2>
                <ul class="list">
                    <li><a href="http://jfsdesigns.net/gallery">The Gallery</a></li>
                            <li><a href="http://jfsdesigns.net/advertisement">Advertisement</a></li>
                    <li><a href="http://jfsdesigns.net/sales">The Store</a></li>
                    <li><a href="http://sdwow.net/">Skin Deep World of Warcraft</a></li>
                </ul>
            </div>
        </div>
    </div>
    <div id="sidebar">
        <ul>
            <li>
                <h2>News</h2>
                <ul>
                    <li>
                        <h3><span>1/28:</span> Template Progress</h3>
                        <p>Today we started on the template you are viewing now. Progress has come far, and we are almost finished!</p>
                    </li>
                </ul>
            </li>
            <li>
                <h2>Advertisement</h2>
                <ul>
                </ul>
            </li>
        </ul>
    </div>
    <div style="clear: both;">&nbsp;</div>
</div>
<hr />
<div id="footer">
    <p id="legal">Copyright &copy; 2008 JFS Designs. All Rights Reserved | Designed by <a href="http://www.freecsstemplates.org/">Free CSS Templates</a></p>
    <p id="links"><a href="">Privacy Policy</a> | <a href="">Terms of Use</a> | <a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional"><abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a> | <a href="http://jigsaw.w3.org/css-validator/check/referer" title="This page validates as CSS"><abbr title="Cascading Style Sheets">CSS</abbr></a></p>
</div>

In the headerinclude template, add your <link> to your CSS (and optionally your meta tags).

Please note: some of your CSS identifiers will conflict with MyBB's default identifiers (like header, logo, menu, etc). You may need to modify your CSS to resolve these conflicts.
First, holly crap your fast. Second, So I can restore the index.php file to default? Third, I this works I love you. Lol
Yes you do have to restore your index.php to default.
There is a border around everything.