Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

How to use blog module for multiple types of blogs in a website

I would like to have the functionality so that I can use the same kind of blogging for different purposes, like creating news, projects and achievements kind of thing? One way I was thinking was to reinstalling the blog module and rename its configuration to the module I like, like for news a news blog with everywhere in code it is using blog I could rename it to news, but it seemed like a lot of work.


  • I would look at creating Post pages based on simple modules:

  • Hey again, I have followed your link and I could made some simple modules through which I can create dynamic pages, but I can't view them through cms view button neither through going to url directly. I have two modules for news and projects and I would like to have a details page for both of them of their individual items, like projects/{slug} but I can't get it to work and keep getting 404.
    One more thing, I can't get the results back in object form, I get it in array of array. How can I get it in object form for which I have a class extending from Base_post_item_model?

  • What does your module configuration look like for the pages?

    If you are getting an array of arrays instead of an array of objects, that's usually because you don't have a record items class setup or it is not setup correctly from the table class model (e.g. public $record_class = 'Example_record';).
    Custom Record Objects

  • edited April 2018

    This is how MY_fuel_modules.php defines modules

    $config['modules']['news'] = array('preview_path' => 'news/{slug}', 'pages' => array('base_uri' => 'news', 'per_page' => 10, 'layout' => 'nt_basic', 'list' => '_posts/posts', 'new' => '_posts/post'));
    $config['modules']['projects'] = array('preview_path' => 'projects/{slug}', 'pages' => array('base_uri' => 'projects', 'per_page' => 10, 'layout' => 'nt_basic', 'list' => '_posts/post', 'project' => '_posts/post'));

    I tried following your example and this is how I have defined in my News class extending from Base_posts_model
    public $record_class = 'New_model';
    And this is my data record class
    class New_model extends Base_post_item_model {}
    But I'm still getting array

  • Okay I have solved the array issue, I changed the value of $record_class from New_model to New

  • I am still stuck on the post page part. How can I view the post on a separate page from list of posts?

  • Did you set up a view to point it to in the configuration:

    'pages' => array(
        'base_uri' => 'articles',
        'per_page' => 10,
        'layout' => 'posts',
        'list' => 'articles/list',
        'post' => 'articles/detail',
  • Can you tell me if I point to my own layout in configuration like you have to posts, I have done it to nt_basic, it should use that layout, right? And what about the list and post keys? I have marked them to use _posts/list and _posts/post, also I am using my record model classes in place of post key

  • Does your news model have a slug field? Also, what appears if you go to /news/{slug} where {slug} is a record's slug value?

  • Yes, I do have it as I followed the simple module approach. When I go to news/{slug} it gives 404

  • Can you go to the Fuel_posts.php file and find all the $this->show_404() and determine if it's hitting any of those and if so which one?

  • Its breaking on the first find of show_404()

    // check if the page is allowed
    if (!$this->is_allowed())
  • The is_allowed is checked for an associated "view" to map to and it appears as though it's not finding one. If you look at the Fuel_posts::page_config() method, it appears to be returning NULL and isn't finding a key for "view" for the specified $this->page_type(). What is the value of $this->page_type() in that method?

  • Yes you are right, it is returning null and the value is slug which I think should find the slug value from database but the module_config method does not return anything

  • Instead of "new" => "_posts/post" use "slug" => "_posts/post"

  • Okay, does this matter if I am doing all this in cms page? I mean my main pages are made in cms and I have configured them in My_fuel_modules.php? I will try your solution ASAP!

  • A module's post pages are meant to be a way to dynamically create pages that use data from simple module and not necessarily a page created in the Pages module.

  • Okay, I understand now and I have got it working, but one thing why slug is working but not my record class object? like new or project?

  • There are predefined page routes that automatically get setup and slug is one of them. You were specifying a key that didn't have a route associated with it. These are the default keys and their associated routes (code lifted from Fuel_posts line 200).

    'archive' => $base_uri.'/archive(/$year:\d{4})(/$month:\d{1,2})?(/$day:\d{1,2})?',
    'tag' => $base_uri.'/tag/($tag:.+)',
    'category' => $base_uri.'/category/($category:.+)',
    'search' => $base_uri.'/search(/$q:.+)?',
    'list' => $base_uri,
    'post' => $base_uri.'/(\d{4})/(\d{2})/(\d{2})/($slug:.+)',
    'slug' => $base_uri.'/($slug:.+)'
Sign In or Register to comment.