Page 1 of 1

Text Limit!

Posted: Mon Apr 14, 2003 3:28 am
by Mr. Tech
Hi!

I am creating a links script.

New what it does is show the title, description etc and then has a more info button.

Now on the page with the title, description etc I want to limit the amount of text shown from the description but when you click more info it shows it full.

E.G:

On The Main Page:

This is a cool product! I reccomend it and...

On The More Info Page:

This is a cool product! I reccomend it and you should buy it now!!!

Any ideas?

Thanks!

Posted: Mon Apr 14, 2003 4:56 am
by Tubbietoeter
I'd use substring or something to copy the first x chars into the variable you display in your overview. Or write yourself a function that gives you the first x words of a string (seperated by " " blank) so the words wont be cut.

Posted: Mon Apr 14, 2003 5:28 am
by volka
if you're using a database that supports it you might query only the amount of characters needed.
e.g. http://www.mysql.com/doc/en/String_func ... ml#IDX1182