Re: Editing in a text area field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 10 Jan 2009 10:40:43 -0500, tedd.sperling wrote:

>[...]
>One might want to design a CMS for a client (I've done it) such that 
>you limit the client's ability to inject presentation choices, such 
>as using bold/italic tags. But that also requires more programming 
>effort to determine if the client has entered well-formed html, which 
>is not easy to do. Lot's of effort for little return.

With a little cooperation from the client, and a properly configured
TinyMCE, you can fairly easily limit what HTML tags they use. You can
then provide a set of CSS classes for specific styles used within the
site, and tell TinyMCE about those classes so that the user can make use
of them (via the Styles drop-down).

The biggest problem is when they copy/paste content from a MS Word
document, but again, with cooperation from the client this can be
cleaned up a bit with the Paste from Word and Paste as Text buttons. If
you really want to limit their ability to mess things up with pasting
from word, specify restrictive limits on the HTML tags and make them
pick CSS classes (styles).

>When confronted with the choice, I try to guide clients into CMS's 
>where I use constructs like 'Please enter the headline here:" and 
>"Please enter the body of the text here:" and then provide the <h1> 
>and <p> tags in the html that delivers the content. That way I 
>control both the data and presentation.

That's my preference too. Unfortunately, it doesn't always meet the
client's requirements. They want to enter rich text, so rich text they
get. Where all they want to do is highlight some things bold or italics,
I only let them have <p>, <br/>, <a>, <strong>, and <em>. Something
else? Let them use the class attribute on anything, or perhaps give them
access to <h1>, <h2>, <h3>.

Sometimes, they want complete freedom, so they get it. They're paying.

>I could imagine a database containing what <h1> means (i.e., 
>font-size, margins, color), but that would not be any different than 
>a simple css file, would it not? And be much simpler.

If you set up whichever rich text editor you use correctly, the user
should be able to see <h1> as defined in your CSS - using CSS! There is
no need for a database to "know" anything about what <h1> tags mean.
With TinyMCE, it means having a subset of the website's stylesheet
duplicated for the editor (and perhaps modified a little too), but
that's no drama once the site design has settled down.
-- 
Ross McKay, Toronto, NSW Australia
"It doesn't matter if the Rock wants to go get diamond rings or not!"
- The Rock

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux