Posted By

ericmuyser on 02/01/11


Tagged


Versions (?)

ls latest blog post except


 / Published in: PHP
 

  1. $post = Blog_Post::create()->limit(1)->order('updated_at DESC')->find_all();
  2.  
  3. if($post):
  4. $url = root_url($site_settings->blog->path) . 'post/' . $post->url_title . '/';
  5.  
  6. preg_match_all('#<p>(.*)</p>#simU', $post->content, $m1, PREG_SET_ORDER);
  7.  
  8. $trim = 250;
  9. $l_1 = strlen($m1[0][1]);
  10.  
  11. if($l_1 < $trim)
  12. $content = '<p>' . $m1[0][1] . '</p>';
  13. else
  14. $content = '<p>' . substr($m1[0][1], 0, $trim) . ' ...</p>';

Report this snippet  

You need to login to post a comment.