Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <?php
  2.  
  3. /*** ADDITIONS ***/
  4. function load_posts($limit=5) {
  5. list($total, $posts) = Post::listing(null, 1, $per_page = $limit);
  6. $posts = new Items($posts);
  7. Registry::set('posts', $posts);
  8. Registry::set('total_posts', $total);
  9. Registry::set('page', "SOMTHING HERE");
  10. Registry::set('page_offset', 1);
  11. if ($total <= 0){
  12. return null;
  13. }
  14. return $posts;
  15. }
  16. function shorten_article($html, $max_words=25) {
  17. $text = strip_tags($html);
  18. $words = implode(' ', array_slice(explode(' ', $text), 0, $max_words));
  19. $words .= '...';
  20. return $words;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement