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

[eluser]Sinclair[/eluser]
Hi,

I have been reading, but I can't understant how to access the $data_template array from the index method.

Here is the code:

Code:
<?php

class Newsletter extends Controller {
      
    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()  
    {  
                
        
        #BEGIN PASSAGENS P O TEMPLATE PRINCIPAL
        # Aqui coloco as configuracoes estáticas da funcao
        $function_name = 'newsletter_index'; # [nomedocontroller_nomedafuncao]
        # Aqui coloco as configuracoes dinamicas da funcao
        $title = 'Newsletter'; # Aqui defino o título da página
        #Aqui passo as zonas para o template principal
        $resultTemp = $this->Template_model->getZonasComAnunciosActivos();
        #END PASSAGENS P O TEMPLATE PRINCIPAL
        
                
        
        # Neste bloco defino a passagem de variáveis para a view
        $this->data_view['result2'] = null;
                
        
        # Neste bloco defino a passagem de variáveis para o template_view
        $this->data_template['function_name'] = $function_name;
        $this->data_template['title'] = $title;
        $this->data_template['resultTemp'] = $resultTemp;
        
        
        $this->load->view ('common/template_view', $this->data_template); # Aqui leio o template comum em "common/template_view.php"        
    }    
      
    
    function subscricaopasso2()  
    {  
        $this->load->library('form_validation');
        
        #BEGIN PASSAGENS P O TEMPLATE PRINCIPAL
        # Aqui coloco as configuracoes estáticas da funcao
        $function_name = 'newsletter_subscricaopasso2'; # [nomedocontroller_nomedafuncao]
        # Aqui coloco as configuracoes dinamicas da funcao
        $title = 'Subscrição da Newsletter, Passo 2'; # Aqui defino o título da página
        #Aqui passo as zonas para o template principal
        $resultTemp = $this->Template_model->getZonasComAnunciosActivos();
        #END PASSAGENS P O TEMPLATE PRINCIPAL
        
              
        # Neste bloco defino a passagem de variáveis para a view
        $this->data_view['result2'] = null;
                
        
        # Neste bloco defino a passagem de variáveis para o template_view
        $this->data_template['function_name'] = $function_name;
        $this->data_template['title'] = $title;
        $this->data_template['resultTemp'] = $resultTemp;
        
        
        # Neste bloco faço as validações
        $this->form_validation->set_rules('email', 'Email Address', 'trim|required|valid_email');
        
        if($this->form_validation->run() == FALSE)
        {
            $this->load->view ('common/template_view', Newsletter::index()->data_template); # Aqui leio o template comum em "common/template_view.php"
        }
        else
        {
            null;
        }        
                
    }
      
  
      
}

?>


How could I access to the $data_template array of the index()?


Best Regards,


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