[PHP] Echo small snippet of content

Status
Not open for further replies.

Sean

‫‫‫‫‫‫  ‫  Don't Worry, Be Happy
Dec 12, 2011
1,121
405
Using Gibbo's Newsys And I want to have it so when it displays the new CONTENT it only displays a few lines, That way they have to click read more to view whole article :)
 

Jian

Resident Weeb
Contributor
Sep 2, 2011
687
437
Firstly, you can use substr() to cut the content to just a number of characters long, then you can add the "read more" when finding the while()loop where the MySQL results will be in.
 

Xenous

o shi
Nov 15, 2011
383
101
Use substr to limit how much it shows!
Example of use:
PHP:
<?php
 
    $string = 'really long string of text and such that people will get to view when they click read MOAR and read MOAR so I get MOAR views and shit';
    //Will return really long string of text...
    echo substr($string,0,25) . '...';
 
?>
 
Status
Not open for further replies.

Users who are viewing this thread

Top