Using a WYSIWYG editor in Textpattern
Hello - welcome to my website.
On my blog I write about marketing, public relations and digital communications. To keep up-to-date with my posts you may want to subscribe to my RSS feed or sign-up to receive blog posts by email.
Thanks for visiting and I hope you find my site useful.
A while back I discovered the excellent X-Standard WYSIWYG editor. Up to then I’d been disappointed with the quality of code produced by WYSIWYG editors, but the X-Standard editor produces clean XHTML and integrates well with CSS.
Having been impressed with the editor and having used it in other content management systems I thought I’d have a go integrating it into Textpattern - whilst Textile is easy and quick to learn, clients seem to want WYSIWYG editors. This might not be everyone’s idea of how Textpattern should work, but if it helps someone then it’s worth sharing here.
A screenshot is available - the width of the editor can be changed in the code inserted into txp_article.php.
It was easier than I thought - I’ve summarised the steps I took below - and please make back-ups in case it goes wrong for you..
1. Download and install the X-Standard editor on your machine
2. Turn off Textile completely in the admin section of Textpattern
3. Edit /textpattern/lib/txplib_head.php and add the code in this file into the header section (around line 30)
4. Edit /textpattern/include/txp_article.php - around line 473 you'll find a textarea field that is the main editor box comes from. Comment out (or delete) this line and replace with the code in this file.
5. Log into Textpattern and the main body of articles should be displayed using the WYSIWYG editor. It shouldn’t take 5 minutes to do the same for the excerpt, but I haven’t had a chance to do that yet.
I did this Textpattern 1.0rc1, so you may need to check the line numbering and PHP code carefully if you’re using an older or newer version, but the principles will be the same.

