wispas Posted January 5, 2010 Share Posted January 5, 2010 I currently have a script that will limit the amount of words string. instead i want it to display all of the text upon clicking a read more link at the end. is this possible with php? Quote Link to comment Share on other sites More sharing options...
wispas Posted January 5, 2010 Author Share Posted January 5, 2010 <?php // Limit $summary to how many characters? $limit = 57; $summary = <<< summary Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text summary; if (strlen($summary) > $limit) $summary = substr($summary, 0, strrpos(substr($summary, 0, $limit), ' ')) . '...'; echo $summary; function bigone() { $limit = 100; echo $summary; } ?> Quote Link to comment Share on other sites More sharing options...
monkeypaw201 Posted January 5, 2010 Share Posted January 5, 2010 You can use a bit of javascript (http://llizard.etherwork.net/cwc/showhide.html) along with PHP's substr() function (http://php.net/manual/en/function.substr.php). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.