Global Includes with HMVC |
[eluser]RMinor[/eluser]
I am using HMVC (https://bitbucket.org/wiredesignz/codeig.../wiki/Home) with CI version 2.1.3. I am stuck on loading views such as a menu, sidebar, or footer into my views for each module. Currently I am using Code: <?php $this->load->view('menu_view'); ?> This is my first HMVC project. Currently I made a separate module for each page (index module, about module, contact module, etc.) each with controllers models, and views. Is this the proper way to do this?
[eluser]PhilTem[/eluser]
This is the proper way of modularizing your project (for when it's the first time that you're using HMVC, but you will get to know more about how to do it in a better way once you're advancing in (H)MVC) Regarding your problem: I'm not quire sure why you're getting an error because HMVC does actually look for you view first in the module's view folder and then in the global view folder. Only if both folders won't contain the file it will not be displayed. If however you're getting an error, I guess than it cannot find the file probably due to a typo You may also want to have a look at the MX_Loader::view() method and do some debugging with it to see which folders it loops through and if the arguments passed are correct.
[eluser]RMinor[/eluser]
Thank you for the response. I found the problem and it was incredibly stupid of me, but I was calling the "menu_view" when it was named "menu.php" in the /application/views/ folder. Sorry for such a dumb mistake. I am sure there will be more questions as I dig in deeper with this HMVC stuff.
[eluser]Altazar[/eluser]
I have a similar problem after installing HMVC. I'm loading header file from global views and it stops at this part: Code: <?php I tried loading URL helper from the same module's controller, but it didn't help. Update - Problem solved. My version of i18n was without this comment: /* in case you use it with the HMVC modular extension uncomment this and remove the other lines load the MX_Loader class */ |
Welcome Guest, Not a member yet? Register Sign In |