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

edited April 2012 in Feature Requests
Hi
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!

Comments

  • edited 2:24PM
    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 2:24PM
    It works prefect! Thank you!
  • edited 2:24PM
    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 2:24PM
    The blog controller allows you to filter on a category like so:
    blog/categories/{category}

    Or a date:
    blog/2012/04/01
    blog/2012/04/
    blog/2012/

    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 2:24PM
    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/website.com/httpdocs/fuel/modules/blog/views/themes/default/post.php on line 29 and defined Filename: libraries/Fuel_blog.php Line Number: 884
Sign In or Register to comment.