Trying to write my own TinyMCE CMS for a client and I am just learning here so bear with me please any help would be greatly appreciated and Thanks in advance and may the force be with you! :-)
I will try to explain as simple as possible...
I am calling TinyMCE editor to edit a text area, Once finishing the rich text with color, font size ect.. I want to save the html not just the text. So when I call it back to my index page it has all it's formatting? I hope that is enough detail? I am actually a hardware tech more than programming, but I enjoy learning new things. ;-)
Hear is my admin.php code:
AND HERE IS MY SAVE.PHP CODE.
I will try to explain as simple as possible...
I am calling TinyMCE editor to edit a text area, Once finishing the rich text with color, font size ect.. I want to save the html not just the text. So when I call it back to my index page it has all it's formatting? I hope that is enough detail? I am actually a hardware tech more than programming, but I enjoy learning new things. ;-)
Hear is my admin.php code:
Code:
<?php
$content = empty($_GET["content"]) ? " " : $_GET["content"]; htmlspecialchars_decode("");
if(!$content){$message1 = " ";}
?>
<html>
<head>
<!--------------------------------------Script Top------------------------------------------------>
<script type="text/javascript" src="http://slip-fall.org/CDDesigns/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
// Theme options
theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "Center",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Skin options
skin : "o2k7",
skin_variant : "black",
// Example content CSS (should be your site CSS)
content_css : "css/example.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
// Replace values for the template plugin
template_replace_values : {
username : "Admin",
staffid : "Admin"
}
});
</script>
<!--------------------------------------------------Script Bottom------------------------------------->
<!------------------------------------Link to Stylesheet------------------------------------------>
<link href="/cddesigns/tinymce/examples/css/content.css" rel="stylesheet" type="text/css" />
<!-------------------------------------Link to Stylesheet------------------------------------------>
<style>
.tdr{text-align:right;}
</style>
</head>
<body>
<form action="save.php" method="post">
<textarea name="content" cols="100" rows="25">Stuff Goes In Between the Tags</textarea><?php echo $message1; ?>
<input type="submit" value="Submit">
</body>
</html>
AND HERE IS MY SAVE.PHP CODE.
Code:
<?php
$content = empty($_POST["content"]) ? " " : $_POST["content"];
if(!$content){header("location:index.html?content=$content");}
else
{
$file = "index.html"; htmlspecialchars("");
$w = fopen($file, "w");
fwrite($w,$content."\r\n");
fclose($w);
}
?>
Comment