I wish to limit the number of characters displayed

In case you have problems with some other PHPJunkyard script (not that there are THAT many).
Post Reply
htmlcssguru
Posts: 2
Joined: Mon Jul 12, 2010 10:10 pm

I wish to limit the number of characters displayed

Post by htmlcssguru »

Script URL: Random text
Version of script: 1.0
Hosting company:
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

I'm using this to display some testimonials as the 'quotes' and it works fine. Problem is that some testimonials are a tad longer than others and i'd like to limit the number of characters that it displays in order to create some consistency in how much space it takes up. What code would I need to put in place in order to limit the number of characters in the display?

Thanks in advance.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Open rantex.php in Notepad and just ABOVE line

Code: Select all

/* Output the image according to the selected type */
paste this

Code: Select all

$txt = substr($txt,0,50); 
This code will limit the output to 50 chars (change 50 to the length you need).
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
htmlcssguru
Posts: 2
Joined: Mon Jul 12, 2010 10:10 pm

Post by htmlcssguru »

Thank you! Did the trick.
Post Reply