limiting entry body

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
cangeceiro
Posts: 3
Joined: Fri Nov 10, 2006 4:43 pm

limiting entry body

Post 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?
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post 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.
Judebert
---
Website | Wishlist | PayPal
Post Reply