Limit textlength in OE?

Author Message

Nicklas Lundgren

Wednesday 10 December 2003 12:29:50 am

Hi,
I have a problem that I suppose a few others has hade before.

I am using the article class to publish news. However, I would like to limit the size of the Intro xml-textfield to 200 characters.

The article class has no property for max textlength. And I cant find any immediate way to customize the OE to do what I want.

Any ideas on how to accomplish this? It is of course important that the user gets a message when the limit is reached.

All ideas greatly appreciated!

Kind regards,
Nicklas Lundgren

Marco Zinn

Wednesday 10 December 2003 12:44:23 pm

Hm... will be difficult...
What do you want to count? The characters in the XML field (including the XML tags)? Or the "rendered" characters? Or the rendered HTML?
I suggest, that you don't limit the field for now, but -if you want to make sure, that noone messes your site up with long intros- use a string operator to limit the intro DISPLAY ("shorten")

Marco
http://www.hyperroad-design.com

Nicklas Lundgren

Wednesday 10 December 2003 1:07:24 pm

Hi all,
Thanks Marco, for your reply.

However, i digged into the code of the OE today, and have managed to add a small counter to the statusbar.

I have made a new ini-file to the OE, maxlength.ini in which I define which parentnodes the restiction should apply to. Also I there state the textlength allowed, and wether it should apply to the "intro" or the "body" field.

It works!

I use textRanges in javascript to prevent the xml-fields from expanding.

Regards,
Nicklas Lundgren

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 31 2025 04:29:23
Script start
Timing: Jan 31 2025 04:29:23
Module start 'layout'
Timing: Jan 31 2025 04:29:23
Module start 'content'
Timing: Jan 31 2025 04:29:23
Module end 'content'
Timing: Jan 31 2025 04:29:23
Script end

Main resources:

Total runtime0.0150 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.1250151.2109
Module start 'layout' 0.00530.0029 739.335936.6328
Module start 'content' 0.00820.0056 775.968890.1094
Module end 'content' 0.01380.0012 866.078133.9922
Script end 0.0150  900.0703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002315.5744140.0002
Check MTime0.00117.2354140.0001
Mysql Total
Database connection0.00074.634910.0007
Mysqli_queries0.002516.855630.0008
Looping result0.00000.106210.0000
Template Total0.00096.110.0009
Template load0.00074.795110.0007
Template processing0.00021.238410.0002
Override
Cache load0.00053.065110.0005
General
dbfile0.001510.213380.0002
String conversion0.00000.053940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs