Hi all,
Please I want to install TinyMCE editor in a php page with simple textarea.
The official installation doesn’t work with me !! [URL=“http://wiki.moxiecode.com/examples/tinymce/installation_example_00.php”]An example.
Thanks:injured:
Why doesn’t it work with you? Is it giving an error? Don’t you see the editor?
Please post the code of your page.
Here is an excerpt from a page that I use tinyMCE on. I hacked out a lot of form stuff that isn’t related to your question.
!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="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-language" content="eng-US" />
<link rel="stylesheet" type="text/css" href="html/default/css/admin.css" />
<title>System Administration Tools</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=300');");
}
// End -->
</script>
<script language="javascript" type="text/javascript" src="/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced",
plugins : "table,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,contextmenu",
theme_advanced_buttons1_add : "fontselect,fontsizeselect",
theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,zoom,separator,forecolor,backcolor",
theme_advanced_buttons2_add_before: "cut,copy,paste,separator,search,replace,separator",
theme_advanced_buttons3_add_before : "tablecontrols,separator",
theme_advanced_buttons3_add : "emotions,iespell,flash,advhr,separator",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
plugin_insertdate_dateFormat : "%Y-%m-%d",
plugin_insertdate_timeFormat : "%H:%M:%S",
extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
external_link_list_url : "example_data/example_link_list.js",
external_image_list_url : "example_data/example_image_list.js",
flash_external_list_url : "example_data/example_flash_list.js"
});
</script>
</head>
<body>
<div class="main">
<div class="content">
<div class="adminheader">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="7" height="140"><img src="html/default/images/index.jpg" style="display:block;" /></td>
</tr>
</table>
</div>
<h1>Create a News Item</h1>
<form action="/admin/newscreate.php" method="post" name="CreateNews" id="CreateNews">
<div>
<input name="newsitemid" type="hidden" value="" />
<input name="calendaritemid" type="hidden" value="" />
<table border="0">
<tr>
<td align="right" valign="top"><b>Main Story:</b></td>
<td valign="top" align="left"><textarea class="error" rows="20" cols="70" name="FullStory"></textarea></td>
</tr>
<tr>
<td align="right" valign="top"><b> Event Title:</b></td>
<td valign="top" align="left"><input size="70" name="CalendarTitle" type="text" /></td>
</tr>
<tr>
<td align="right" valign="top"><b></b></td>
<td valign="top" align="left"><input name="btnClear" value="Clear" type="reset" /> <input name="btnSubmit" value="Submit" type="submit" /></td>
</tr>
</table>
</div>
</form>
<br />
<div class="footer">
Footer stuff</div>
</div>
</div>
</body>
</html>
The biggest trick to making it work is to get the paths setup correctly to the javascript files. I tend to use absolute paths which makes it easier to figure out where stuff is.
Hope this helps.
-
Are you sure the js is here “/tinymce/jscripts/tiny_mce/tiny_mce.js” ? That is, parting from the root directory?
Maybe it should be “tinymce/jscripts/tiny_mce/tiny_mce.js” ? That is, parting from the current directory? -
Did you try to make it work with the simple, basic setup like in the example link you posted? If it works that way, the problem might lie in one of the extra init parameters.
The code I posted works and that is how the server my client is using is configured. So, yes the js path really is /tinymce/jscripts… Like I said, this is working today.
I have no idea what the original poster has setup on their server. I was only posting a working example.
Oops…
Well thanks very much for the help
my code is
<html>
<head>
<title>TinyMCE Test</title>
<script language=“javascript” type=“text/javascript” src=“staff/assets/js/tiny_mce/tiny_mce.js”></script>
</head>
<body>
<!-- form sends content to moxiecode’s demo page –>
<form method=“post” action=“ok.php”>
<script language=“javascript” type=“text/javascript”>
tinyMCE.init({
mode : “textarea”
});
</script>
<textarea name=“content” cols=“50” rows=“15”>This is some content that will be editable with TinyMCE.</textarea>
<input type=“submit” value=“Save” />
</form>
</body>
</html>
The script works very well thank you very much:D !!!
Put this
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textarea"
});
</script>
in the head section of your page.
Thanx:blush:
No problem. I’ve made the same mistake so many times myself
I never understood why some JS must be in that part of the page. One day, when I have the time, I’ll look into it