Question about layouts and the blog module
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
$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.
This seems to be exactly what I'm looking for. I'm going to give it a try!