Forums
This topic is locked
limiting characters
Posted 07 Jul 2002 16:33:58
1
has voted
07 Jul 2002 16:33:58 Barry Williams posted:
hi, i would like to know if there is a way and what it is to do the following. i want to limit how many characters will show up in a region on my page. i would like it so that no matter how many characters the field in the database holds that it shows only a set amount on the page itself...eg. you have a field in your database that has the following stored in it. "hi my names fred and i like beer and walking on warm summer nights" but in the display box (where i'm displaying the record) is says this "hi my names fred and i like be..." notice how i included the "..." at the end. any ideas? Replies
Replied 07 Jul 2002 21:44:38
07 Jul 2002 21:44:38 Dave Clarke replied:
have a look in the extensions section ithink there are a couple in there that will trim text.
Dave
Dave
Replied 07 Jul 2002 22:17:33
07 Jul 2002 22:17:33 Dave Thomas replied:
Quite an easy thing to do this.
On the field that you want limiting, you just need to alter it a little.
So: (tags not included, for display reasons)
<b>(rsRecordset.Fields.Item("Description"
.Value) </b>
becomes:
<b>Left(rsRecordset.Fields.Item("Description"
.Value, 100)</b>
Left= from the leftmost character.
Value, 100 = 100 characters only.
and to show the trailing dots, simply type ... into the table cell after the dynamic data.
"Get the kettle on, time for a brew"
Edited by - UltraDav on 07 Jul 2002 22:18:34
Edited by - UltraDav on 08 Jul 2002 07:21:30
On the field that you want limiting, you just need to alter it a little.
So: (tags not included, for display reasons)
<b>(rsRecordset.Fields.Item("Description"

becomes:
<b>Left(rsRecordset.Fields.Item("Description"

Left= from the leftmost character.
Value, 100 = 100 characters only.
and to show the trailing dots, simply type ... into the table cell after the dynamic data.
"Get the kettle on, time for a brew"
Edited by - UltraDav on 07 Jul 2002 22:18:34
Edited by - UltraDav on 08 Jul 2002 07:21:30
Replied 07 Jul 2002 22:56:09
07 Jul 2002 22:56:09 Dave Thomas replied:
Oh by the way, you can delete any post you write, with the little dustbin icon on the top of your post. (for your double post)
"Get the kettle on, time for a brew"
"Get the kettle on, time for a brew"
Replied 08 Jul 2002 06:23:09
08 Jul 2002 06:23:09 Barry Williams replied:
thanx UltraDav for your help