New Videos
We released two new video overviews yesterday. Actually, it was originally a single video, and was posted to Bonfire's Facebook page that way, but we had to split them up to fit them over at YouTube.
The first takes you through the installation process of Bonfire from start to finish.
The second one is a quick overview of nearly every core module by touring the admin area.
Both of these can be found on the revised Learn page. Enjoy!
Module Builder Demo
The ModuleBuilder in Bonfire has just had a major overhaul on how powerful and easy it is to use. Between Sean's and Icehawg's work, this thing is becoming a beast. I am so thrilled by what they've done that I wanted to create a quick video for everyone to get a taste of what Bonfire can really do for you.
The video isn't the highest quality, unfortunately. It is in my computer, but the YouTube uploading process seemed to do something wonky to it. I apologize for that. This is my first video I've done and uploaded there, so I'm sure I have a lot left to learn.
To get your own bonfire started, download the latest develop branch from GitHub.
Understanding the Base Controllers
Bonfire ships with several controllers for you to extend when making your application. Which one you use depends completely on where you are using it and what you need to accomplish. Let's take a quick look at the different controllers and their suggested uses.
Base Controller
All of the custom controllers extend from the Base_Controller. This class extends the MX_Controller which gives you all of the power of WireDesign's HMVC available to all of your classes. That allows for a different way of working, but also a very powerful one. We won't go into that here.
This is the place that you want to setup anything that should happen for every page of your site:
- Setup environment-specific settings, like turning the profiler on for development and off for production and testing.
- Get the cache setup correctly. This is currently setup to only use a file-based cache, but you can easily tell it to use APC if available, and fallback to the file system if not.
This controller also sets up System Events that will get executed just before and just after the Base_Controller's constructor runs. We'll cover Events in another post.
Front Controller
The Front_Controller is intended to be used as the base for any public-facing controllers. As such, anything that needs to be done for the front-end can be done here.
Currently, it simply sets the active theme. You could also set the default theme here, if you create a parent theme 'framework' to use with all of your sites that you extend with child themes.
Authenticated Controller
This controller forms the base for the Admin Controller. It was broken into two parts in case you needed to create a front-end area that was only accessible to your users, but that was not part of the Admin area and didn't share the same themes, etc. All changes you make here will affect your Admin Controller's though, so use with care. If you need to, reset the values in the Admin Controller.
This controller currently:
- Loads in all of the user-associated models, like the user_model, permission_model, etc
- Restricts access to only logged in users
- Gets form_validation setup and working correctly with HMVC.
You might extend this controller by storing the current user in a variable that all child classes can access for ease of use.
Admin Controller
The final controller sets things up even more for use within the Admin area of your site. That is, the area that Bonfire has setup for you as a base of operations. It currently:
- Loads the pagination libraries and sets them up for a consistent user experience.
- Gets the admin theme loaded and makes sure that some consistent CSS files are loaded so we don't have to worry about it later.
With all of this being loaded, won't it affect performance? Well, to a very small extent, yes. There are always trade-offs to be made between convenience and speed. In this case, the trade-off is a little bit of extra memory usage. All of the controllers are automatically loaded, and they're all contained in a single file, so there isn't the performance hit of extra files being loaded in.
The hope is that having the base controllers available is a simple way to speed up your development time while making a minimal impact on performance.
Got suggestions for ways to improve this system or it's performance? Do you have new ways to use these controllers or favorite tasks you take care of here? Leave a comment so we can build a better tool for all of us.
