[HELP] Read More

Status
Not open for further replies.

Kryptos

prjRev.com
Jul 21, 2010
2,205
1,252
As I'm going to do a news system I want to know how to do the 'read more'
So, i get maybe... 50 characters from the message with a query and output them and then say 'Read more' to go to the articles url.
Anyone knows how to do this?
 

RastaLulz

fight teh power
Staff member
May 3, 2010
3,926
3,921
This should work.
PHP:
<?php
$previewLength = 50;
if(strlen(strip_tags($article)) > $previewLength) {
  echo substr(strip_tags($article), 0, $previewLength).'..<br /><br />[<a href="#">Read More</a>]';
}else{
  echo strip_tags($article).'<br /><br />[<a href="#">Read More</a>]';
}
?>
 
Status
Not open for further replies.

Users who are viewing this thread

Top