Include mybb editor in custom pages
Lokki Offline
Junior Member
**
Posts: 6
Joined: May 2010
Post: #1
Include mybb editor in custom pages
hello everyone

I want to include mybb editor in a custom page.
I tryed to add this

Code:
<script type="text/javascript" src="jscripts/post.js?ver=1400"></script>


and this

Code:
<textarea id="message" name="message" rows="20" cols="70" tabindex="2" >{$message}</textarea>
{$codebuttons}


but it's not working.

any idea how can I do this?

03-30-2011 11:05 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #2
RE: Include mybb editor in custom pages
you have to include editor.js.

take a look at this post..

[Image: banner.png]
03-31-2011 12:19 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #3
RE: Include mybb editor in custom pages
There may be more dependencies that he's simply not including (eg prototype).

My Blog
03-31-2011 09:51 AM
Find all posts by this user Quote this message in a reply
Lokki Offline
Junior Member
**
Posts: 6
Joined: May 2010
Post: #4
RE: Include mybb editor in custom pages
i included th editor but still not working

in my custom page I have {$headerinclude} where is included prototype

Should I include them directly in my custom page without {$headerinclude}?
03-31-2011 04:16 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #5
RE: Include mybb editor in custom pages
How about giving more details, including full code, and explain how you're implementing it (through MyBB templates I presume?).

My Blog
03-31-2011 04:46 PM
Find all posts by this user Quote this message in a reply
Lokki Offline
Junior Member
**
Posts: 6
Joined: May 2010
Post: #6
RE: Include mybb editor in custom pages
ok

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); 
?>


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>

03-31-2011 05:10 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #7
RE: Include mybb editor in custom pages
(03-31-2011 05:10 PM)Lokki Wrote:  this page it's not located in the root directory of mybb it is located in another directory
Problem right there.  You need to update your relative paths (to scripts) if it's not in the same directory.
Besides, you haven't included the editor.js anywhere in the code you've given.

My Blog
03-31-2011 08:23 PM
Find all posts by this user Quote this message in a reply
Lokki Offline
Junior Member
**
Posts: 6
Joined: May 2010
Post: #8
RE: Include mybb editor in custom pages
(03-31-2011 08:23 PM)ZiNgA BuRgA Wrote:  Problem right there.  You need to update your relative paths (to scripts) if it's not in the same directory.
Besides, you haven't included the editor.js anywhere in the code you've given.

i tryed to include editor.js, i tryed to change the relative paths before and nothing
03-31-2011 08:37 PM
Find all posts by this user Quote this message in a reply
techu Offline
Member
***
Posts: 154
Joined: Sep 2010
Post: #9
RE: Include mybb editor in custom pages

Code:
1
2
3
4
5
6
7
8
9
<?php
define('IN_MYBB', 1); 
require "global.php"; 

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

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

Put this php in forum root..

And use this code in template

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<html>
<head>
<title>{$mybb->settings[bbname]}</title>
{$headerinclude}
</head>
<body>
{$header}
<br />
<table width="100%" border="0">
<tr><td>
<textarea id="message" name="message" rows="20" cols="70" tabindex="2" ></textarea> 
<!-- start: codebuttons --> 
<script type="text/javascript" src="jscripts/editor.js?ver=1600"></script> 
<script type="text/javascript"> 
<!--
	var editor_language = {
	title_bold: "Insert bold text",
	title_italic: "Insert italic text",
	title_underline: "Insert underlined text",
	title_left: "Align text to the left",
	title_center: "Align text to the center",
	title_right: "Align text to the right",
	title_justify: "Justify text",
	title_numlist: "Insert numbered list",
	title_bulletlist: "Insert bulleted list",
	title_image: "Insert image",
	title_hyperlink: "Insert hyperlink",
	title_email: "Insert email address",
	title_quote: "Insert quoted text",
	title_code: "Insert formatted code",
	title_php: "Insert formatted PHP code",
	title_close_tags: "Close any open MyCode tags that you currently have open",
	enter_list_item: "Enter a list item. Click cancel or leave blank to end the list.",
	enter_url: "Please enter the URL of the website.",
	enter_url_title: "Optionally, you can also enter a title for the URL.",
	enter_email: "Please enter the email address you wish to insert.",
	enter_email_title: "Optionally, you may also enter a title for the email address.",
	enter_image: "Please enter the remote URL of the image you wish to insert.",
	enter_video_url: "Please enter the URL of the video.",
	video_dailymotion: "Dailymotion",
	video_googlevideo: "Google Video",
	video_metacafe: "MetaCafe",
	video_myspacetv: "MySpace TV",
	video_vimeo: "Vimeo",
	video_yahoo: "Yahoo Video",
	video_youtube: "YouTube",
	size_xx_small: "XX Small",
	size_x_small: "X Small",
	size_small: "Small",
	size_medium: "Medium",
	size_large: "Large",
	size_x_large: "X Large",
	size_xx_large: "XX Large",
	font: "Font",
	size: "Text Size",
	color: "Text Color"
};
	var clickableEditor = new messageEditor("message", {lang: editor_language, rtl: 0, theme: "default"});
	if(clickableEditor)
	{
		clickableEditor.bindSmilieInserter("clickable_smilies");
	}
// -->
</script> 
</td></tr>
</table>


[Image: banner.png]
04-01-2011 02:23 AM
Find all posts by this user Quote this message in a reply
Lokki Offline
Junior Member
**
Posts: 6
Joined: May 2010
Post: #10
RE: Include mybb editor in custom pages
ok i made it Smile
I just copyed the jscripts folder into my other folder and I use the code from techu for the template page and now it's working
thank you so much everyone
(This post was last modified: 04-01-2011 03:47 AM by Lokki.)
04-01-2011 03:44 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: