Question about layouts and the blog module

edited March 2016 in Modules
Hello!

I recently decided to give FUEL CMS a try but there is one thing (there will probably be more in the future) I don't understand.

I started my project by creating a few simple pages and my own layout. After this I decided to add a blog to the project. When I added the blog I could view the posts by going to /blog but these pages didn't use my own layout. Also I wanted to the first 5 posts to be on the homepage.

Because of the layout problem I thought I had to move my layout to the views folder in the blog module and set the default_controller to /blog. This worked fine, but now my pages and my blog were still using a different layout.

So my question is:

How do I make the blog module and my pages work together in the same layout?

I hope my problem and question are clear, if not, feel free to ask for more information.

Thanks in advance!

Comments

  • edited 5:19PM
    There are 3 configuration values you can set for the blog under Settings in the CMS or can be done manually in the fuel/modules/blog/config/blog.php (settings in the CMS will take precedence):
    $config['blog']['theme_path'] = 'themes/default'; // The view file path $config['blog']['theme_layout'] = 'blog'; // The layout file name $config['blog']['theme_module'] = 'blog'; // The module to look in, change to "app"to have it look in your application/view folder

    What we normally do for our setups is the following which allows us to use a theme folder in the application/views/blog.:
    $config['blog']['theme_path'] = 'blog'; // The view file path $config['blog']['theme_layout'] = 'mylayout'; // The layout file name $config['blog']['theme_module'] = 'app'; // The module to look in, change to "app"to have it look in your application/view folder

    If you have an existing layout in your application/views/_layouts/, you can just add the following to your application/views/blog/_layouts/:
    $this->load->view('_layouts/my_layout');

    Additionally, if you have page variables you want to include from the CMS, you can create a page of "blog" in the CMS and that layout will have those variables applied to it.
  • edited 5:19PM
    Thank you for your quick response!

    This seems to be exactly what I'm looking for. I'm going to give it a try!
Sign In or Register to comment.