How do I create previous and next button in Fuelcms blog?

edited April 2012 in Feature Requests
I am trying to add a previous and next button in Fuelcms blog single post.
I found the $this -> fuel_blog -> get_next_post() which returns the whole next post in the same page.
Is there any way I can do to return an url which refers to the previous and next post?

Thanks you!


  • edited 1:41AM
    You can use the url property on that object to get the next url:
    $next = $this -> fuel_blog -> get_next_post(); $url = $next->url;
  • edited 1:41AM
    It works prefect! Thank you!
  • edited 1:41AM
    Thanks for the quick reply. I got one more tricky situation:
    Is there a way that I can get the archive post in certain category?
    For example, I want to have a link to a page which only contains posts in "test" category and in April 2012.
  • edited 1:41AM
    The blog controller allows you to filter on a category like so:

    Or a date:

    However, it does not out of the box allow you to filter on a date within a particular category. To add that functionality, you would need to modify the fuel/modules/blog/controllers/categories.php controller to have similar functionality as that found in the fuel/modules/blog/controllers/blog.php controller's _remap function.
  • edited 1:41AM
    Has this property been updated for the latest version of Fuel. I'm trying to implement the same functionality for my blog posts, but it's causing an error:

    A PHP Error was encountered Severity: Warning Message: Missing argument 1 for Fuel_blog::get_next_post(), called in /var/www/vhosts/ on line 29 and defined Filename: libraries/Fuel_blog.php Line Number: 884
Sign In or Register to comment.