Textarea which allows HTML content in Database [duplicate] - php

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
javascript WYSIWYG HTML editors?
Im not quite sure how to put this as i dont know what its called. But essentially what i need is a textarea like the one on stack overflow with a Bold button where you highlight text, or bullet points etc and I have heard there are some good open source ones.
I have a database with php going into it from a plain text area, i just need to be able to do extra features.
Many thanks!

From another thread where I posted the same answer:
There are many to choose from. Among the most popular are:
Aloha Editor - Open Source browser based html5 enabled rich text
editor.
CKEditor - Open Source browser based rich text editor.
TinyMCE - Open Source editor control.
WYMeditor - Open Source XHTML editor focusing on semantic markup.
Dijit Editor - a Dojo-based rich text editor component.
YUI Rich Text Editor - a Yahoo! rich text editor component.
KindEditor - Open Source HTML editor.
Source: http://en.wikipedia.org/wiki/Rich-text_editor

I personally use http://ckeditor.com/ for most things, since you can customize it to meet your demands with relative ease, and dispite many WYSIWYG editors it actually handles the generated HTML quite well.
For the textarea to receive and send off data, you will need to consult the documentation for the WYSIWYG editor you are using, since it varies from editor to editor, how you manipulate, set and get data.
You will need to output the HTML with PHP like this:
echo htmlspecialchars($database_stuff["content"]);
Then the otuputted content will not be parsed by the browser (but by the WYSIWYG editor - if parsed at all).

Related

WYSIWYG editor choices

CKEditor is a very good HTML editor. However, when I paste some html structure and shift to the WYSIWYG mode, the editor automatically reform the html structure which I do not expect, and therefore the original html layout is changed.
I would like to explore if there would be other alternative editors that can preserve the entire codes with the these characteristics:
capture external css file to become inner editor css
capture external template for inner editor usage
be able to integrate with elfinder 2.0
function similar to ckeditor, when applying contenteditable="false", that particular div will be frozen and cannot be edited.
I have always used TinyMCE: http://www.tinymce.com/
It is highly customizable, and compatible in most browsers including mobile.

Text editor for CMS

I have a website and I have created the CMS for it using PHP and mySQL.
When I edit the content with the CMS I am actually editing the content stored inside mySQL then, using PHP, the content is displayed back to the site by reading the updated content from mySQL.
Now I am looking for a text editor to use inside my CMS to format the text and display the "formated" text on my site.
Any suggestions?
Thanks!
One of the most popular and easiest editor to use is TinyMCE available at:
http://www.tinymce.com/
Another few editors i know of but don't use anymore are:
FCKEditor (Maybe the same as CKEditor that Shyiu proposed)
Xinha Open Source Editor
I recommend TinyMCE for it's flexibility, speed and ease of use compbined with JQuery support.
Good luck
I have used CKEditor in one of the projects i worked and i worked fine for me
http://ckeditor.com/
You can take a look at WMD editor

API for writing in textarea with HTML code

I want users to write HTML code, so they could format text and I could put that into database. I want users to be able to make lists, bold text, italic and I guess that's it. Thanks.
You should use ckeditor.
CKEditor is a text editor to be used inside web pages. It's a WYSIWYG editor, which means that the text being edited on it looks as similar as possible to the results users have when publishing it. It brings to the web common editing features found on desktop editing applications like Microsoft Word and OpenOffice.
for replacing all text area with html editor refer below link.
http://svn.ckeditor.com/CKEditor/trunk/_samples/php/replaceall.php
I just recently implemented Chipersoft's version of WYSIWYG Markdown Editor, works much like Stackoverflow's markdown editor.
You can save the markdown version in your database, then when you want to render it, you can use PHP Markdown to convert it from marked down to actual HTML tags.
These two apps work great together, and means less of a footprint in your database (and on filesystem), because you are not having to store the full blown html tags.
Markdown Editor: https://github.com/ChiperSoft/wmd
Markdown to HTML Converter: http://michelf.com/projects/php-markdown/

edit uploaded docx file in PHP

I need to open uploaded .docx file and possibility to change values. I know, that docx file consists of xml files. So, the main question is maybe somebody know a good WYSIWYG web-based xml editor?
I know one called XOPUS, but i have no idea how to configure it. Maybe somebody knows other alternatives for that task or advices, how to put xml file to textfield, where i could change values.
There are a couple of PHP toolkits that you can use for this task, first off there's an early dev on on codeplex:
http://openxmlapi.codeplex.com/
However you may b better off with one of the more mature ones:
http://holloway.co.nz/docvert/index.html
http://www.phpdocx.com/
Both of these can convert from docx to most of the popular formats, HTML included.
Once you've converted to something like HTML, then you can use an onscreen editor such as tiny MCE:
http://www.tinymce.com/
To provide in page rich editing capabilities, before finally using the above toolkits to convert back to DOCX or any other applicable format.
Update February 2014
Since I first wrote this reply things have moved on. The open xml kits I mentioned above are still valid, however in page editing is now more of a possibility than ever using the new HTML5 content editable and edit mode attributes.
It's now insanely easy to add your own buttons (Using something like bootstrap) above a div that has a content editable attribute attached to it.
Connecting the buttons to "document.execCommand" can then send, bold, italic, underline, link & image creation, list insertion and all manner of other HTML constructions methods directly to this div without needing anything like tinyMce or another in page editor anymore.
There is full details available on the Mozilla developer network, and I am planning o do a blog post on using this stuff very soon.
Have you tried PHPWord?
One may use the DocxUtilities class of PHPDocX to do some partial editing of an existing Word document.
This class allows you for:
searching and replacing a particular string of text
searching a string of text and remove the containing paragraph or section
highlight predefined strings (search and highlight)
full merging of docx files (text, images, charts, footnotes, ...)
If that is not enough for your purposes you should then prepare a PHPDocX template to fully customized an existing Word document.

Read and write rich text files from TinyMCE in php

I am making a file uploader and editer in PHP using the TinyMCE rich text editor.
Which all files/types can be edited in TinyMCE.
Whats best was to edit a server file in TinyMCE.
How do i save to file edited in TinyMCe and what format should i save.
Sample code will be helpful.
In case tinymce is not right editor, please just another open source rich text editor.
TinyMCE is just a WYSIWYG editor which means that it cannot read or write content to files, but it can interpret html to visual texts.
You can exchange html between TinyMCE and you php code then write it as you want into files.
You can use some APIS to convert your files content into HTML to read it, these are some links to read write MS Word Content
How can I display Word documents in a textarea using PHP?
Create Word Document using PHP in Linux
Regards
NiL

Categories