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

you have to include editor.js.

take a look at this post..
There may be more dependencies that he's simply not including (eg prototype).
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}?
How about giving more details, including full code, and explain how you're implementing it (through MyBB templates I presume?).
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:
<?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:
<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)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.
(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

Code:
<?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:
<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>

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
Pages: 1 2
Reference URL's