Embed Blog Posts on Every Page

edited June 2013 in Feature Requests
Does anybody have some code that I can copy to show the most recent 5 blog posts anywhere on the website, regardless of whether its the News page or not? I want to show this on the footer of every page.

Does the Blog module work just like other modules in the sense that I can use the fuel_model() function right inside the view I want to embed the blog posts in?

Thanks,
Erik

Comments

  • edited 7:58PM
    The Fuel_blog class has a "get_recent_posts" method on it which you can call like so in 1.0:
    $posts = $CI->fuel->blog->get_recent_posts(5)

    You could also use the fuel_model function but you'll need to specify the "module" parameter like so:
    $posts = fuel_model('blog_posts', array('module' => 'blog', 'limit' => 5))
  • edited 7:58PM
    Great, I'll have to try this out! i made my own custom DB logic to pull it in manually, but this would be way cleaner!

    Erik
Sign In or Register to comment.