Include mybb editor in custom pages
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #11
RE: Include mybb editor in custom pages
(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:
1
2
3
4
5
6
7
8
9
10
<?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:
1
2
3
4
5
6
7
8
9
10
<?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:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<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>


04-01-2011 03:47 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: Include mybb editor in custom pages - RateU - 04-01-2011 03:47 AM

 Standard Tools
Forum Jump: