CodeIgniter Forums
problem with calling a method in a method. - 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: problem with calling a method in a method. (/showthread.php?tid=56576)



problem with calling a method in a method. - El Forum - 01-03-2013

[eluser]soyut[/eluser]
Hello,

I was calling a method/function in a another method.
But when it runs the function it doesn't continue the code. it just stops there.

How can I sort this out.

Code:
public function rep(){
    if ($this->input->post('submit'))
          {
            if($this->input->post('date1')){
                if($this->input->post('date2')){
          
      $data['reports'] = $this->blog_model2->reporting();
          $reports =array();    
    
        
    
        
        $this->topdf();
//topdf function is printing out the search results in pdf format.

        $this->load->view('header_view');
        $this->load->view('nav_view');
        $this->load->view('nav2_view');
        $this->load->view('report_view', $data);
        
        $this->load->view('footer_view');
        
        }
        else{
            
            
            echo "Please enter a valid end date!";
        }
            
       }
       else{
            echo "Please enter a valid start date!";
        }
        
        
        } //submit
        else {
        
        $this->load->view('header_view');
        $this->load->view('nav_view');
        $this->load->view('nav2_view');
        $this->load->view('report_view');
        $this->load->view('footer_view');
        
        }
    }



problem with calling a method in a method. - El Forum - 01-03-2013

[eluser]jprateragg[/eluser]
What function is causing the problem, and what is the error message? Is this function in a library, helper, MY_Controller, or MY_Model?


problem with calling a method in a method. - El Forum - 01-04-2013

[eluser]bigbusty[/eluser]
I really don't want to mess with your habits and whats good for you but for the sake of readability and coding standards, read the CodeIgniter Style Guide found here http://ellislab.com/codeigniter/user-guide/general/styleguide.html and tell us where the problem is. Posting some code doesn't do the magic.

reformatted
Code:
public function rep()
{
    if ($this->input->post('submit'))
    {
        if($this->input->post('date1'))
        {
            if($this->input->post('date2'))
            {
                $data['reports'] = $this->blog_model2->reporting();
                $reports =array();

                $this->topdf();
                //topdf function is printing out the search results in pdf format.

                $this->load->view('header_view');
                $this->load->view('nav_view');
                $this->load->view('nav2_view');
                $this->load->view('report_view', $data);

                $this->load->view('footer_view');

            }
            else
            {
                echo "Please enter a valid end date!";
            }

        }
        else
        {
            echo "Please enter a valid start date!";
        }
    } //submit
    else
    {
        $this->load->view('header_view');
        $this->load->view('nav_view');
        $this->load->view('nav2_view');
        $this->load->view('report_view');
        $this->load->view('footer_view');
    }
}