Forums

This topic is locked

limiting characters

Posted 07 Jul 2002 16:34:09
1
has voted
07 Jul 2002 16:34:09 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 16:35:09
07 Jul 2002 16:35:09 Barry Williams replied:
sorry about the multi post <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>
Replied 07 Jul 2002 18:21:15
07 Jul 2002 18:21:15 aegis kleais replied:
Easy enough.

Assuming the data is in a db field called "fldDescription" and you have a recordset called rs, try:

&lt;%
strConvert = (rs.Fields.Item("fldDescription".Value)
' convert string to the first 20 most characters
strConvert = Left(strConvert,20) & "..."
%&gt;

and later on in your code use:

&lt;%= strConvert %&gt;

to print out the first 20 characters.


Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])
Replied 07 Jul 2002 18:26:48
07 Jul 2002 18:26:48 Albert Gruig replied:
hello,
sorry for my English, I am French, a good excuse <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
I have to create an extension to do this, for Ultradev or Dream MX, I can send it to you.

Replied 07 Jul 2002 18:31:11
07 Jul 2002 18:31:11 Albert Gruig replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello,
sorry for my English, I am French, a good excuse <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
I have to create an extension to do this in PHP, for Ultradev or Dream MX, I can send it to you.


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Replied 07 Jul 2002 20:08:00
07 Jul 2002 20:08:00 aegis kleais replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
hello,
sorry for my English, I am French, a good excuse <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
I have to create an extension to do this, for Ultradev or Dream MX, I can send it to you.


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Oh. An extension to do this. I'm sorry, but I don't know how to make extensions. What I gave you was the ASP code to do what you asked for, but if you can find someone who can show you how to make an extension, you can incorporate that code into it and it should give you the desired results.

Best of luck!

Aegis Kleais
New Media Web Developer
(DWMX : IIS5.1 : SQL2K : WXP : ASP[VB/JS])

Reply to this topic