Announcing Bonfire - A jumpstart for your web apps |
[eluser]tieungao[/eluser]
[quote author="Basketcasesoftware" date="1303939811"]@tieungao - You need to study Wiredesignz HMVC system. It's not required that you use it for Bonfire, but it's nice to have it. By default Bonfire starts out as the normal CodeIgniter MVC structure. But if you look in Bonfire's folder structure you will see a "modules" folder. To see this in operation do this. In the modules folder create a folder called "home". Inside "home" create the the folders "controllers", "views", and "models". Move the home.php file from the application/controllers folder to the modules/home/controllers folder. Point your browser to your Bonfire project. You'll notice no change, even though the starting controller is now in a completely different folder. Now move the home.php file from the application/views folder to the modules/home/views folder. Notice that, again, there is no change in the final output. If you want to see a simple layout using just CI and HMVC I prepared a simple zip file on my own site you can download. I don't remember the exact thread I did that for but looking at it's file structure might help you have a better understanding of the HMVC patttern. HMVC example[/quote] First of all, thanks so much for helping me understand with a very clearly instruction about HMVC. So when u told me that "Move the home.php file from the application/controllers folder to the modules/home/controllers folder. Point your browser to your Bonfire project. You'll notice no change" , so this home controller still auto detect that this view files is application/views/home.php? If i understand correct, it will find in application/views folder first and if not found home.php, it goes to modules/home/views to find home.php? And i discovery that in the docs they said : Code: With the exception of the Public context, creating a controller for your module for a specific controller is a simple as naming your controller to match the context. A controller for the content context, would be named content.php, while one that shows up in the settings context would be named setting.php. For the public context, the controller should be named the same as the module. For example, a Pages module would have a public controller called pages.php. because he already define something at application/config/router.php about that, and if follow this rules to name controller, i dont need to add more route there. If i want to create a controller not follow this rules and i must add more route at route.php. Thank you again for your userful and clearly instruction. |
Welcome Guest, Not a member yet? Register Sign In |