MyBB Hacks

Full Version: Include mybb editor in custom pages
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(03-31-2011 05:10 PM)Lokki Wrote: [ -> ]this is the php code for may page
this page it's not located in the root directory of mybb it is located in
another directory

Code:
<?php
chdir('../');
define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("Anunturi", "index.php"); 

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


Probably you need to call build_mycode_inserter() in it?
Something like this:

PHP Code:
<?php
chdir('../');
define('IN_MYBB', 1); 
require "./global.php"; 

add_breadcrumb("Anunturi", "index.php"); 
$codebuttons = build_mycode_inserter();
eval("\$anuntindex = \"".$templates->get("anuntindex")."\";"); 
output_page($anuntindex); 
?>



(03-31-2011 05:10 PM)Lokki Wrote: [ -> ]and this is the template code of the page where I try to include mybb editor

Code:
<html>
<head>
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table width="100%" border="0">
<thead>
<tr>
<th>Categorii</th>
</tr>
<tbody>
<?php include"anunturi/categorii.php";?>
<textarea id="message" name="message" rows="20" cols="70" tabindex="2" >{$message}</textarea>
{$codebuttons}
</tbody>
</table>
{$footer}
</body>
</html>


And use a 'fix' URL in the javascript using {$mybb->settings['bburl']}, something like this:

HTML Code
<html>
<head>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/post.js?ver=1400"></script>
</head>
<body>
{$header}
<br />
<table width="100%" border="0">
<thead>
<tr>
<th>Categorii</th>
</tr>
<tbody>
<?php include"anunturi/categorii.php";?>
<textarea id="message" name="message" rows="20" cols="70" tabindex="2" >{$message}</textarea>
{$codebuttons}
</tbody>
</table>
{$footer}
</body>
</html>


Then, edit codebuttons template:
Find:

HTML Code
<script type="text/javascript" src="jscripts/editor.js?ver=1600"></script>


Replace it with:

HTML Code
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/editor.js?ver=1600"></script>

thank you so much RateU, your method works too
Pages: 1 2
Reference URL's