check controller status in DB before executing |
[eluser]Blux[/eluser]
Hello everybody .. This is my first project with CI, loving it by the way, and i hope someone could help me with my problem. =) basically what i want to do is to make my model check on the database before running a controller. i'm using a function in my model that run a check if certain database record exist or not, if not it shows an error message, or else continue and run the controller ! Code: public function load($controller) i'm using Matchbox, and the controllers are in /application/modules folder .. i tried using Wick but it didn't work for me ... any thoughts would be appreciated =D thank you in advance =)
[eluser]davidbehler[/eluser]
You could use a pre_controller hook: http://ellislab.com/codeigniter/user-gui...hooks.html
[eluser]Blux[/eluser]
Thank you for the replay. However, i think a hook won't do what is in my mind. i need it to only be activated for the controllers in /application/modules/some_module/controllers/ .. not the ones in /application/controllers/ .. i did try what you have suggested, and there was a problem and didn't work. It gave me: Fatal error: Class 'Model' not found in /Applications/MAMP/htdocs/CI/system/application/models/load/load_Model.php on line 11 thank you again =)
[eluser]Blux[/eluser]
no one can help me with this ? anything will do .. i just need to check before processing the controller can i change the router.php or my_router.php or even the loader.php ?
[eluser]Blux[/eluser]
solved! =D by adding a peace of code in My_Router.php Code: if(isset($path2[7])){ not the best way, but it will help in my case, for now =) |
Welcome Guest, Not a member yet? Register Sign In |