Jump to content


Photo

I need help with TinyMce


  • Please log in to reply
4 replies to this topic

#1 chriggi

chriggi
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 06 March 2006 - 06:41 PM

hello everybody!

I want to implement the tinymce editor (wysiwyg) to my news system...but I'm a real noob so i ask you to help me :)

So here's my news script:




<? include('dbconnect.php'); ?>
<form action="addnews.php" method="post">
<br>Title:
<br><input name="title" type="text" value="Title">
<br>Author:
<br><input name="user" type="text" value="Name">
<br>Date:
<br><input name="date" type="text" value="<?php print date("F j Y"); ?>">
<br>Icon:
<br><input name="icon" type="text" value="Icon URL">
<br>Message:
<br><textarea name="message" cols="40" rows="6" value="Message"> </textarea>
<br>Password:
<br><input name="password" type="password">
<br><input name="submit" type="submit" value="Submit">
<?php $password="yourpassword"; //change this to the password you want if ($_POST['password']==$password){ //DO NOT CHANGE THIS LINE
if (isset($_POST['submit'])) {
include("dbconnect.php");
$title = addslashes(strip_tags($_POST['title']));
$user = addslashes(strip_tags($_POST['user']));
$icon = addslashes(strip_tags($_POST['icon']));
$message = $_POST['message'];
$date = addslashes(strip_tags($_POST['date']));
$sql = "INSERT INTO newscms SET title='$title', user='$user', icon='$icon', message='$message', date='$date'";
if (mysql_query($sql)) {
echo("Your news has been added.");
} else {
echo("Error adding entry: " . mysql_
error() . "");
}
}
?>

And the one from TinyMCE is:


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Full featured example</title>
<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : & #34;table,save,advhr,advimage,advlink,iespell,insertdatetime,preview,zoom,flash,
searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,-emotions,fullpage",
        theme_advanced_buttons1_add_before : "save,newdocument,separator",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
        theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
        theme_advanced_buttons3_add_before : "tablecontrols,separator",
        theme_advanced_buttons3_add : & #34;emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,ful
lscreen,fullpage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        content_css : "example_full.css",
        plugin_insertdate_dateFormat : "%Y-%m-%d",
        plugin_insertdate_timeFormat : "%H:%M:%S",
        extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        external_link_list_url : "example_link_list.js",
        external_image_list_url : "example_image_list.js",
        flash_external_list_url : "example_flash_list.js",
        file_browser_callback : "fileBrowserCallBack",
        theme_advanced_resize_horizontal : false,
        theme_advanced_resizing : true,
        apply_source_formatting : true
    });

    function fileBrowserCallBack(field_name, url, type, win) {
        // This is where you insert your custom filebrowser logic
        alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);

        // Insert new URL, this would normaly be done in a popup
        win.document.forms[0].elements[field_name].value = "someurl.htm";
    }
</script>
<!-- /TinyMCE -->
<!-- Self registrering external plugin, load the plugin and tell TinyMCE where it's base URL are -->
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/plugins/emotions/editor_plugin.js"></script>
<script language="javascript" type="text/javascript">tinyMCE.setPluginBaseURL('emotions', '../jscripts/tiny_mce/plugins/emotions');</script>
</head>
<body>

[Full featured example] <a href="example_advanced.htm">[Advanced example]</a> <a href="example_simple.htm">[Simple example]</a>  <a href="example_word.htm">[Word example]</a>

<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">
    <h3>Full featured example</h3>
    This page shows all available plugins that are included in the TinyMCE distribution. Some of these plugins will only be visible on MSIE due to the lack of some support in FF. For more details on the various options on TinyMCE check the <a href="../docs/index.html">manual</a> or for more third party plugins check the plugin section.<br /><br />
    <textarea id="elm1" name="elm1" rows="15" cols="80" style="width: 100%">
    <span class="example1">Test header 1</span><br />
    <span class="example2">Test header 2</span><br />
    <span class="example3">Test header 3</span><br />
    Some <b>element</b>, this is to be editor 1. <br /> This editor instance has a 100% width to it.
    <p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p>
    <img src="logo.jpg">
    </textarea>
    <br />
    <input type="submit" name="save" value="Submit" />
    <input type="reset" name="reset" value="Reset" />
</form>
</body>
</html>




I hope you can help me.

Thank you very very much for your help!

greets

PS: I can give you an msn 8 invitation or a gmail invitation if you do this for me....i could also make sth. in photoshop for you 'cause im more a designer...

#2 me1000

me1000
  • Members
  • PipPipPip
  • Advanced Member
  • 183 posts

Posted 07 March 2006 - 12:09 AM

Try this, I just installed this like 2 days ago...

<? include('dbconnect.php'); ?>
<html>
<head>
<title>Full featured example</title>
<!-- TinyMCE -->
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
    tinyMCE.init({
        mode : "textareas",
        theme : "advanced",
        plugins : & #34;table,save,advhr,advimage,advlink,iespell,insertdatetime,preview,zoom,flash,

searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,-emotions,fullpage",
        theme_advanced_buttons1_add_before : "save,newdocument,separator",
        theme_advanced_buttons1_add : "fontselect,fontsizeselect",
        theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
        theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
        theme_advanced_buttons3_add_before : "tablecontrols,separator",
        theme_advanced_buttons3_add : & #34;emotions,iespell,flash,advhr,separator,print,separator,ltr,rtl,separator,ful

lscreen,fullpage",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_path_location : "bottom",
        content_css : "example_full.css",
        plugin_insertdate_dateFormat : "%Y-%m-%d",
        plugin_insertdate_timeFormat : "%H:%M:%S",
        extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
        external_link_list_url : "example_link_list.js",
        external_image_list_url : "example_image_list.js",
        flash_external_list_url : "example_flash_list.js",
        file_browser_callback : "fileBrowserCallBack",
        theme_advanced_resize_horizontal : false,
        theme_advanced_resizing : true,
        apply_source_formatting : true
    });

    function fileBrowserCallBack(field_name, url, type, win) {
        // This is where you insert your custom filebrowser logic
        alert("Example of filebrowser callback: field_name: " + field_name + ", url: " + url + ", type: " + type);

        // Insert new URL, this would normaly be done in a popup
        win.document.forms[0].elements[field_name].value = "someurl.htm";
    }
</script>
<!-- /TinyMCE -->
<!-- Self registrering external plugin, load the plugin and tell TinyMCE where it's base URL are -->
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/plugins/emotions/editor_plugin.js"></script>
<script language="javascript" type="text/javascript">tinyMCE.setPluginBaseURL('emotions', '../jscripts/tiny_mce/plugins/emotions');</script>
</head>
<body>
<form action="addnews.php" method="post">
<br>Title:
<br><input name="title" type="text" value="Title">
<br>Author:
<br><input name="user" type="text" value="Name">
<br>Date:
<br><input name="date" type="text" value="<?php print date("F j Y"); ?>">
<br>Icon:
<br><input name="icon" type="text" value="Icon URL">
<br>Message:
<br><textarea name="message" cols="40" rows="6" value="Message"> </textarea>
<br>Password:
<br><input name="password" type="password">
<br><input name="submit" type="submit" value="Submit">
<?php $password="yourpassword"; //change this to the password you want if ($_POST['password']==$password){ //DO NOT CHANGE THIS LINE
if (isset($_POST['submit'])) {
include("dbconnect.php");
$title = addslashes(strip_tags($_POST['title']));
$user = addslashes(strip_tags($_POST['user']));
$icon = addslashes(strip_tags($_POST['icon']));
$message = $_POST['message'];
$date = addslashes(strip_tags($_POST['date']));
$sql = "INSERT INTO newscms SET title='$title', user='$user', icon='$icon', message='$message', date='$date'";
if (mysql_query($sql)) {
echo("Your news has been added.");
} else {
echo("Error adding entry: " . mysql_
error() . "");
}
}
?>
</form>
</body>
</html>

BTW the code your using looks a little off to me. I added a small javascript to it and it worked.
alos you need to change this line
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js">
to reflect the location of your script :)

#3 chriggi

chriggi
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 07 March 2006 - 07:40 PM

Hey!

First of all thank you very much for all the effort!

Bur I'm sad to day that the code didn't change anything to me :S The message box ist still the same and not tinymce...? Did I do something wrong?

I hope you can fix that.

As I said if you want help with Photoshop or if you want an msn 8 invitation just tell me...

greets

#4 me1000

me1000
  • Members
  • PipPipPip
  • Advanced Member
  • 183 posts

Posted 08 March 2006 - 12:14 AM

Well that was my first attempt, I will try it a diffrent way. I know it was extrememly easy for my to install when I did it. again make sure that line reflects the location of the script (and only that line)

try this, A friendly sugestion... your code looks a lttle messy you dont have any head html or body tags, also you were missing the close form tag.

<? include('dbconnect.php'); ?>
<html>
<head>

<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    plugins : "table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,flash,searchreplace,print,contextmenu",
    theme_advanced_buttons1_add_before : "save,separator",
    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,print",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_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>
<!-- use <body onload="HTMLArea.replaceAll()" if you don't care about
     customizing the editor.  It's the easiest way! :) -->
<body onLoad="HTMLArea.replaceAll()">

<form action="addnews.php" method="post">
<br>Title:
<br><input name="title" type="text" value="Title">
<br>Author:
<br><input name="user" type="text" value="Name">
<br>Date:
<br><input name="date" type="text" value="<?php print date("F j Y"); ?>">
<br>Icon:
<br><input name="icon" type="text" value="Icon URL">
<br>Message:
<br><textarea name="message" cols="40" rows="6" value="Message"> </textarea>
<br>Password:
<br><input name="password" type="password">
<br><input name="submit" type="submit" value="Submit">
<?php $password="yourpassword"; //change this to the password you want if ($_POST['password']==$password){ //DO NOT CHANGE THIS LINE
if (isset($_POST['submit'])) {
include("dbconnect.php");
$title = addslashes(strip_tags($_POST['title']));
$user = addslashes(strip_tags($_POST['user']));
$icon = addslashes(strip_tags($_POST['icon']));
$message = $_POST['message'];
$date = addslashes(strip_tags($_POST['date']));
$sql = "INSERT INTO newscms SET title='$title', user='$user', icon='$icon', message='$message', date='$date'";
if (mysql_query($sql)) {
echo("Your news has been added.");
} else {
echo("Error adding entry: " . mysql_
error() . "");
}
}
?>
</form>
</body>
</html>





#5 chriggi

chriggi
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 March 2006 - 02:13 PM

Hi!

Thank you for the help!

But this didn't work either....but I've now done it myself thanks anyway!

greets




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users