Page 1 of 1

Need to shorten a result.

Posted: Mon Jul 28, 2003 2:45 am
by Adam
The problem is on the main page of my website at http://www.gamer-talk.net/. If you look in the reviews and previews box, the text is too long and makes it go 2 lines sometimes. I want to nake it so if it's too long, it will just go ...

i.e. Super Mario Advance 4: Super Mario Bros. 3 -> Super Mario Advance 4: Super Mario...

The code I have to display that is.

Code: Select all

<font class="<? echo "$platclass"; ?>"><? echo "$system"; ?>:</font> <a href="preview<? echo "$id"; ?>.html"><? echo "$name"; ?></a>
thanks for any help

Posted: Mon Jul 28, 2003 5:13 am
by Fredix
Actually you approx. know how many characters fit into one line so you should take the sentence from the database and display eg. the first 20 caracters and then add "..."

Posted: Mon Jul 28, 2003 5:35 am
by Adam
I dont know how to code this... Can you or anyone help?

Posted: Mon Jul 28, 2003 5:43 am
by Tubbietoeter
try to use substr


see details on http://www.php.net