CodeIgniter Forums
Am I doing this right? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Am I doing this right? (/showthread.php?tid=32935)



Am I doing this right? - El Forum - 08-10-2010

[eluser]Wonder Woman[/eluser]
Hi,


I am currently developing a search and I want it all to be controlled in the one controller.

Like such:

Code:
class Properties extends Controller {

    function index()
    {
        if($this->validation->run()==FALSE){
            $this->load->view('properties/index');
        }
        else {
            $this->load->view('properties/search');
        }
    }

    function search()
    {
        if($this->validation->run()==FALSE){
            $this->load->view('properties/search');
        }
        else {
            $this->load->view('properties/results');
        }
    }


    function results()
    {
                $data['results'] = 'results to go here';
                $this->load->view('properties/results', $data);
        }
}

Is this the best way to do this? I can't seem to get the urls correct, for example when I want the url to be 'properties/search' it just goes to 'properties'.

Any help would be great, thanks.


Am I doing this right? - El Forum - 08-10-2010

[eluser]danmontgomery[/eluser]
What does
Quote:when I want the url to be 'properties/search' it just goes to 'properties'
mean?


Am I doing this right? - El Forum - 08-10-2010

[eluser]fMertins[/eluser]
Hi there, it seems you need to use redirect() function, instead of loading the view.