Kryptos prjRev.com Jul 21, 2010 2,205 1,252 Dec 31, 2010 #1 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?
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?
Dayron1234 Rapnameiszero,cuzIhavezero,toleranceforidiots Jun 30, 2010 772 35 Dec 31, 2010 #2 Take the coding from PHPretro or UberCMS or Holocms so on? Upvote 0 Downvote
Kryptos prjRev.com Jul 21, 2010 2,205 1,252 Dec 31, 2010 Thread starter #3 No, because they don't have it. Anyone knows what's the query or the code? Upvote 0 Downvote
RastaLulz fight teh power Staff member May 3, 2010 3,934 3,933 Dec 31, 2010 #4 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>]'; } ?> Upvote 0 Downvote
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>]'; } ?>
Kryptos prjRev.com Jul 21, 2010 2,205 1,252 Dec 31, 2010 Thread starter #5 Thanks Rasta, [MOD] Problem solved, thread closed. [/MOD] Upvote 0 Downvote