MyBB Community Forums

Full Version: Include MyBB Header on Custom Pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have the following situation:

A custom page (chat in this case), that is in a subfolder. It uses its own classes / templates etc.

Now I want to put my normal header into the page layout, which is html, however I am not sure how to include it?

I can't just use the standard {headerinclude}, as it does not using the standard MyBB templates.

Please can you advise what I can do to pull the header across?

Cheers

Matt
Sorry I am not sure how to use that tutorial, or if it will indeed work.

The file I am editing is a html file, as shown here:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
<head>
	<title>Carpe Noctem Chat</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

  <script src="js/prototype.js" type="text/javascript"></script>
  <script src="js/scriptaculous.js" type="text/javascript"></script>
  <script src="js/chat.js" type="text/javascript"></script>
  <script src="./?MessagesForJs" type="text/javascript"></script>
  <link href="styles/<?=$_SESSION['etchat_'.$this->_prefix.'style']?>/style.css" rel="stylesheet" type="text/css"/>

<!-- window.js Class zum erzeugen der Fenster -->
<!-- info http://prototype-window.xilinus.com -->
<script type="text/javascript" src="js/window.js"></script>
<link href="styles/default_2create_win.css" rel="stylesheet" type="text/css"/>

  <script type="text/javascript">

window.onload = function() {
	var chatObj = new ET_Chat();
	chatObj.messages_im_chat=<?=$_SESSION['etchat_'.$this->_prefix.'anz_messages_im_chat']?>;
	chatObj.reload_interval=<?=$_SESSION['etchat_'.$this->_prefix.'config_reloadsequenz']?>;
	chatObj.username='<?=$_SESSION['etchat_'.$this->_prefix.'username']?>';
	chatObj.user_id='<?=$_SESSION['etchat_'.$this->_prefix.'user_id']?>';
	chatObj.userPrivilegienGlobal='<?=$_SESSION['etchat_'.$this->_prefix.'user_priv']?>';
	chatObj.win_style='<?=$_SESSION['etchat_'.$this->_prefix.'style']?>';
	chatObj.anbindung_an_userverwaltung=<?=(!empty($_SESSION['etchat_'.$this->_prefix.'logout_url'])) ? "true" : "false";?>;
	chatObj.show_history_all_user=true; //sonst wird die History nur fuer Admin u Mod sichtbar
	chatObj.set_dynamic_height=true; // sonst hat das ganze Chat eine feste Hoehe
	chatObj.textcolor='<?=$_SESSION['etchat_'.$this->_prefix.'textcolor']?>';
	chatObj.start();
	chatObj.userOnline();
	if ( Prototype.Browser.IE ) 
		$("splitpane").onmousedown = function(){ chatObj.dragSplitpane(); }
	else 
		chatObj.dragSplitpane();
}

  </script>

</head>

<body id="body_id">
<div id="rahmen_um_alles">
<div id="kopf"><div align="center"><img src='http://vampirecounts.net/chat/et_chat_v306/img/chatbanner.png'></div>
<div id="onlinelist"><img src="img/ajax-loader.gif" alt="" /></div>
<div id="splitpane"></div>
<div id="chatinhalt"></div>

<div id="form">
<form id="message_form" style="display:inline;" action="">

<div id="form_left">

<div id="privat_anzeige"><?=$this->lang->privat_anzeige[0]->tagData?></div>

<input type="hidden" name="room" id="room" value="1" />
<input type="hidden" name="privat" id="privat" value="" />
<input type="hidden" name="bold" id="bold" value="normal" />
<input type="hidden" name="italic" id="italic" value="normal" />
<input type="hidden" name="color" id="color" value="#<?=$_SESSION['etchat_'.$this->_prefix.'textcolor']?>" />

<input name="message" id="message" type="text" class="input" style="width:400px;" />
</div>
<div id="form_right">
<img id="link_sagen" class="img_button" src="img/Checked.png" width="32" height="32" border="0" alt="<?=$this->lang->sagen[0]->tagData?>" title="<?=$this->lang->sagen[0]->tagData?>" />&nbsp;&nbsp;&nbsp;
<img id="link_smileys" class="img_button" src="img/Smiley_Cool.png" width="32" height="32" border="0" alt="<?=$this->lang->smileys[0]->tagData?>" title="<?=$this->lang->smileys[0]->tagData?>" />&nbsp;&nbsp;&nbsp;
<img id="link_color" class="img_button" src="img/Colors.png" width="32" height="32" border="0" alt="<?=$this->lang->color[0]->tagData?>" title="<?=$this->lang->color[0]->tagData?>" />&nbsp;&nbsp;&nbsp;
<img id="link_prop" class="img_button" src="img/Display.png" width="32" height="32" border="0" alt="<?=$this->lang->prop[0]->tagData?>" title="<?=$this->lang->prop[0]->tagData?>" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<img id="link_logout" class="img_button" src="img/Delete_big.png" width="32" height="32" border="0" alt="<?=$this->lang->logout[0]->tagData?>" title="<?=$this->lang->logout[0]->tagData?>" />
</div>
</form>
<div align="right"> <?=$this->lang->hallo_user[0]->tagData?> <b><?=$_SESSION['etchat_'.$this->_prefix.'username']?></b>!<br/>
Carpe Noctem Chat powered by ET - Chat v3.X.X by <a href="http://www.sedesign.de" target="_blank">SEDesign</a> &copy; 2009</div>
</div>

</div>
</body>
</html>

This is the file that alters the layout of the page in question. As I said, the whole chat is in its own subfolder, and does not access any MyBB files to run.

If you can please advise how I do it in this file?
I think the tutorial explains everything very clearly...

Create a new template as described, insert your own code there (use {$header}, {$footer} and such to dynamically load your header and footer) and make the php file (which connects do the database and retrieves the template you created).
I also noticed you didn't include global.php.
(2011-05-02, 07:04 PM)faviouz Wrote: [ -> ]I think the tutorial explains everything very clearly...

Create a new template as described, insert your own code there (use {$header}, {$footer} and such to dynamically load your header and footer) and make the php file (which connects do the database and retrieves the template you created).

Ok, I understand creating the template, and the php file which combined effectively is a new page. However how do I use that on this particular html file to load the header / footer. I am sorry if I am asking a dumb question, but I have very little experience with coding.