Brain Fart

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Brain Fart

Post by Jade »

Hey,

I can't remmber the function that you use when you don't want to display a whole big long thing of text. Like in those news articles where they have some of the article and then they put the ellipses (...) so that it doesn't display the whole text but a part of it with the button you can click to read the rest of it. Can any of you remember how to do this?

Jade
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Code: Select all

<?php
$description =  substr($row[4], 0, 200). "... [IN FULL]" 
?>
This outputs 200 characters of $row[4] and appends ... [IN FULL], where $row[4] is the full news story from a database.

You are then free to do what you want with $description.
Post Reply