473,385 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with PHP GET and POST, show TinyMCE editor HTML formatting

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:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $content = empty($_GET["content"]) ? " " : $_GET["content"]; htmlspecialchars_decode("");
  3.  
  4. if(!$content){$message1 = " ";}
  5.  
  6. ?>
  7. <html>
  8. <head>
  9.  
  10. <!--------------------------------------Script Top------------------------------------------------>
  11. <script type="text/javascript" src="http://slip-fall.org/CDDesigns/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
  12. <script type="text/javascript">
  13. tinyMCE.init({
  14.         // General options
  15.         mode : "textareas",
  16.         theme : "advanced",
  17.         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",
  18.  
  19.         // Theme options
  20.         theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
  21.         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",
  22.         theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
  23.         theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
  24.         theme_advanced_toolbar_location : "top",
  25.         theme_advanced_toolbar_align : "Center",
  26.         theme_advanced_statusbar_location : "bottom",
  27.         theme_advanced_resizing : true,
  28.  
  29.         // Skin options
  30.         skin : "o2k7",
  31.         skin_variant : "black",
  32.  
  33.         // Example content CSS (should be your site CSS)
  34.         content_css : "css/example.css",
  35.  
  36.         // Drop lists for link/image/media/template dialogs
  37.         template_external_list_url : "js/template_list.js",
  38.         external_link_list_url : "js/link_list.js",
  39.         external_image_list_url : "js/image_list.js",
  40.         media_external_list_url : "js/media_list.js",
  41.  
  42.         // Replace values for the template plugin
  43.         template_replace_values : {
  44.                 username : "Admin",
  45.                 staffid : "Admin"
  46.         }
  47. });
  48. </script>
  49.  
  50.  
  51.  
  52. <!--------------------------------------------------Script Bottom------------------------------------->
  53.  
  54.  
  55.  
  56.  
  57. <!------------------------------------Link to Stylesheet------------------------------------------>
  58.  
  59. <link href="/cddesigns/tinymce/examples/css/content.css" rel="stylesheet" type="text/css" />
  60.  
  61. <!-------------------------------------Link to Stylesheet------------------------------------------>
  62.  
  63.  
  64. <style>
  65. .tdr{text-align:right;}
  66. </style>
  67. </head>
  68. <body>
  69.  
  70.  
  71. <form action="save.php" method="post">
  72. <textarea name="content" cols="100" rows="25">Stuff Goes In Between the Tags</textarea><?php echo $message1; ?>
  73. <input type="submit" value="Submit">
  74.  
  75.  
  76. </body>
  77. </html>
  78.  


AND HERE IS MY SAVE.PHP CODE.




Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $content = empty($_POST["content"]) ? " " : $_POST["content"];
  3.  
  4. if(!$content){header("location:index.html?content=$content");}
  5. else
  6. {
  7.  $file = "index.html"; htmlspecialchars("");
  8.  $w = fopen($file, "w");
  9.  fwrite($w,$content."\r\n");
  10.  fclose($w);
  11.  }  
  12. ?>
Jan 27 '13 #1
2 4585
Anas Mosaad
185 128KB
Please format your code using the CODE tags to make it readable.
Jan 27 '13 #2
Sorry I don't know what you mean CODE Tags? :-(
Jan 27 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Lucy | last post by:
help! javascript inline of an HTML to open an HTML in a target window. Something like... <html> <head> <title>test</title> </head> <body>
2
by: meburke | last post by:
I've written quite a bit of early php code, but nothing really web and database-specific (more like administrative and maintenance stuff for LINUX), but now I need to develop some serious web...
7
by: dh.evolutionnext | last post by:
Hey, I am an instructor and I have an XML class coming up. I would just like to know a good, easy, and intuitive XML editor that does validating, code completion, etc. I usually use NetBeans but...
4
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use...
0
by: surendra.rajput | last post by:
hi all friends I want your help. I am working with HTML help Workshop ,In run time it show first page Blank(Default page) .How i can Set First Page of Help file . thank you surendra
4
by: Goo | last post by:
Hi. Looking for some advice. I have a simple javascript that gathers email from a HTML form and then upon the submit button click, it opens a default mail window with "mailto" and inserts...
4
by: Mickey | last post by:
Hi, I have a question that maybe someone can help me with? I have a html textarea. I want to make a menu bar for it. This menu bar should add <p<i<betc... tags to highlighted text. Plus...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.