Load function, not view |
[eluser]RobbieL[/eluser]
At the end of a controller, instead of loading a view, is it possible to load a function? I know you can redirect to a function, but that doesn't allow you to carry $data ... does it? Cheers. RobbieL
[eluser]gtech[/eluser]
yes you can load a function, if the functions in the same controller, you dont have to load a view at all. $this->functionname($param1,$param2);
[eluser]RobbieL[/eluser]
Ah, excellent. I've got another related problem. I want to pass a varible to the function I'm going to be loading. So I place it where you've put $param1. I gather I have to then, in the function I'm loading, put function index($param1). When I do that, I get an spit up on my page regarding that parameter. Any ideas?
[eluser]RobbieL[/eluser]
Oh, think I got it. Had to set the parameter in the index function to be FALSE by default.
[eluser]gtech[/eluser]
Code: <?php Not sure I understand your question so I shall do a quick example see above.. it defaults to "Nobody likes fish" if you call it with: http://localhost/......./index.php/test/fish/Wilma it will display "Wilma likes fish" [edit]sorry missed your reply, glad you got it working
[eluser]RobbieL[/eluser]
Cheers gtech, that actually helped a great deal. My problem was I was trying to pass two parameters to my Index function, by in the function they were being passed from only one of the variables was actually being declared. Thanks again! |
Welcome Guest, Not a member yet? Register Sign In |