Welcome Guest, Not a member yet? Register   Sign In
How to call a method in the same class?
#11

[eluser]laytone[/eluser]
Is this what your wanting?

Code:
<?php

class Newsletter extends Controller {
    
    public $data_template;
      
    function Newsletter()
    {
        parent::Controller();
        
        $this->load->helper('form');
        $this->load->helper('url');
        $this->load->helper('array');
        $this->load->helper('my_addjsfile_helper');
        $this->load->helper('my_addbodytag_helper');
        $this->load->model('Template_model');
    }
      
    function index()  
    {          
        $this->data_view['result2'] = null;  //this is used for what?
        
        $this->_setIndexTemplateData();

        $this->load->view ('common/template_view', $this->data_template); # Aqui leio o template comum em "common/template_view.php"        
    }    
      
    function _setIndexTemplateData(){
        $this->data_template['function_name'] = 'newsletter_index';
        $this->data_template['title'] = 'Newsletter';
        $this->data_template['resultTemp'] = $this->Template_model->getZonasComAnunciosActivos();
    }
    
    function subscricaopasso2()  
    {  
        $this->load->library('form_validation');
        $this->data_view['result2'] = null; //Again,  what is this doing?
        $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');

        if($this->form_validation->run() == FALSE)
        {
            //Form Didn't Validate,  relod the default data into $this->data_template and load the view...
            $this->_setIndexTemplateData();
            $this->load->view ('common/template_view', $this->data_template);
        }
        else
        {
            //Your form validated so do this
            $this->data_template['function_name'] = 'newsletter_subscricaopasso2';
            $this->data_template['title'] = 'Subscrição da Newsletter, Passo 2';
            $this->data_template['resultTemp'] = $this->Template_model->getZonasComAnunciosActivos();
                
           $this->load->view ('common/template_view', $this->data_template);
        }
    }

}

?>


Messages In This Thread
How to call a method in the same class? - by El Forum - 02-16-2010, 12:16 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:21 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:22 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:25 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:27 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:37 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:39 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:50 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 12:53 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 01:01 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 02:15 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 02:23 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 04:56 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 05:43 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 06:02 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 06:27 PM
How to call a method in the same class? - by El Forum - 02-16-2010, 08:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB