Results 1 to 2 of 2

Thread: how to implement text editor in basic php cms?

  1. #1
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    472
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default how to implement text editor in basic php cms?

    i 'm trying to make a website base php + CMS.

    What i already do:
    Basic php + CMS (add, delete, edit)

    Problem:
    1. This is my first time developing CMS
    2. I want to use this text editor in my CMS:http://www.dynamicdrive.com/dynamici...itor/index.htm


    This is an example of my form

    addnews:
    Code:
    <!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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Add News</title>
    <script language="javascript">
    function cekform(){
    	//ini untuk ngecek formnya (semua form tidak boleh kosong)
    	if(document.frmnews.txtsubject.value==""){
    		alert('Subject Must be Filled');
    		document.frmnews.txtsubject.focus();
    		return false;
    	}
    	else if(document.frmnews.txtcontent.value==""){
    		alert('Content Must be Filled');
    		document.frmnews.txtcontent.focus();
    		return false;
    	}
    	else {
    		return true;
    	}
    }
    </script>
    </head>
    
    <body bgcolor="#CCCCCC">
    <div align="center">
    <table width="800" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
        <td colspan="2"><?php include "header.php";?></td>
      </tr>
      <tr>
        <td width="160" valign="top"><?php include "menu.php";?> </td>
    	<td width="640" align="center" valign="top">
    	  <p><br>
              <!-- Content Here -->
    	  </p>
    <form action="" method="post" name="frmnews" onsubmit="return cekform()">
    <table width="500px" border="1">
      <tr>
        <td>Subject </td>
        <td><input name="txtsubject" type="text" id="txtsubject" /></td>
      </tr>
      <tr>
        <td>Content</td>
        <td><textarea  name="txtcontent" id="txtcontent" rows="20" cols="50"></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td><input name="tblIsi" type="submit" id="tblIsi" value="add" /></td>
      </tr>
    </table>
    
    </form>
     </td>
      </tr>
      <tr>
        <td colspan="2"><?php include "footer.php";?></td>
      </tr>
    </table>
    </div>
    </body>
    <?
    include "connect.php";
    if(isset($_POST['tblIsi'])){
    	$subject = $_POST['txtsubject'];
    	$date = date("d/m/y");
    	$content = $_POST['txtcontent'];
    	$sql="insert into news(subject,content,date) values('$subject','$content','$date')";
    
    	$kueri = mysql_query($sql);
    	if($kueri){
    		echo "<script>alert('News success insert to DB');document.location='news.php'</script>";
    			
    	} else {
    		echo "<script>alert('News failed insert to DB')</script>";
    		echo mysql_error();
    	}
    }
    include("disconnect.php");
    ?>
    This is my basic CMS form look like without text editor


    thx in advanced for your attention...
    Last edited by davelf; 04-13-2010 at 07:04 AM.
    _____________________

    David Demetrius // davejob
    _____________________

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    So do the scripts you have work already and do the add/edit/delete part?
    Do you just want help integrating the WYSIWYG editor into the form?

    Please provide more info.

    If not, you might want to look at this simple CMS script here: Lil CMS: http://www.lilcms.com/
    It's what I keep going back to. It only performs the edit part of your requirements but you can create new files using this script: http://www.phptoys.com/e107_plugins/...php?content.29

    Then you could integrate TinyMCE into Lil CMS, which is a really nice WYSIWYG editor and you can pick and choose your own toolbar functions: http://tinymce.moxiecode.com/examples/full.php

    Thats what I did and with a bit of CSS, I came up with this for my own uses:


    Alternatively you could try this script: XQTO File Manager: http://www.xqto.com/filemanager.php

    Hope that helps

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •