Page 1 of 1

limiting entry body

Posted: Fri Nov 10, 2006 4:46 pm
by cangeceiro
im looking for a way to limit the string length of entry bodies in serendipity, i would also like to restrict images to the extended body only. I was trying to dig thru the code to add this functionality, but im not finding it. anyone know how to accomplish this?

Posted: Fri Nov 10, 2006 8:51 pm
by judebert
There is no way to limit the length of a text field in HTML. The solution would need to be either JavaScript or server-side. Likewise, HTML does not include a way to limit the contents of a text field, so limiting images to the extended body would have to be JavaScript or server-side, too.

If you want to do the checking before the entry is submitted, use JavaScript. I'm afraid I'm not much help there; I can tell that the HTML is emitted from entries.inc.php.

If you want to do the checking on the server side, I'd check out the "Rules for publishing" plugin, serendipity_event_entrycheck. It currently checks for a few option before actually saving the entry, and can print an error page if there's a problem. You could just add code to check for <img> tags and add an entry max and min length.