codex73

Splitting String and Merging POP

Feb 24th, 2012
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. ##PHP Code
  2. //Divides String after amount of spaces between words + 1
  3. $arr = explode(" ",$contents,100+1);
  4. //Grabs the the end of the array value.
  5. $last = array_pop($arr);
  6. //Compile all the strings again into one.
  7. $contents = implode(" ",$arr)." ".'<a href="">Read More...</a></p><div class="content_more" style="display:none">'." ".$last."</div>";
  8.  
  9. //Notice the open paragraph tag.
  10. <div class="rower2 rb">            
  11. <p>
  12.     $contents                                
  13. </div>
  14.  
  15. //HTML Output
  16. <p>
  17. The start of the content post. More content here.
  18. <a href="">Read More...</a>
  19. </p>
  20. <div class="content_more" style="display:none">
  21. The rest of the contents.
  22. </div>
Advertisement
Add Comment
Please, Sign In to add comment