Using redirect() ? |
[eluser]chefnelone[/eluser]
Hello, I just can't redirect to other function and stop in that function. When the site is loaded is routed to load index/index. So far so good. Then I'like to redirect in the __construct function so that if the var $in_construction is set to 'yes' it should be redirect to the in_construction function. Below what I've done, this code make the redirection but it ALSO execute the index function. I mean it execute the line: Code: $this->load->view('in_construction'); Code: $this->load->view('index'); What I need is just to run the in_construction function but not the index function Code: class Index extends MY_Controller {
[eluser]InsiteFX[/eluser]
Code: class Index extends MY_Controller { I would implement away to set the $in_construction variable! It should not be hard coded into the constructor. InsiteFX
[eluser]chefnelone[/eluser]
[quote author="InsiteFX" date="1285605531"] Code: class Index extends MY_Controller { I would implement away to set the $in_construction variable! It should not be hard coded into the constructor. InsiteFX[/quote] I did what you say before, but the problem is that if I add a new functions I'll need to repeat the if sentence again and again. That's why I want to include it in the constructor... It shouldn't be difficult to do it ...
[eluser]treeface[/eluser]
If you find yourself reusing a controller-specific variable or function repeatedly across multiple controllers, you might have found yourself a perfect opportunity to extend the base Controller class. See here for more information: http://stackoverflow.com/questions/16263...ller-class |
Welcome Guest, Not a member yet? Register Sign In |