CodeIgniter Forums
Functions Do Not Load Correctly? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Functions Do Not Load Correctly? (/thread-9421.html)



Functions Do Not Load Correctly? - El Forum - 06-24-2008

[eluser]amw_drizz[/eluser]
I am witting out an application and working on a multi page registration form. And when the 1st registration page loads with my template/theme correctly. Then when you load the user verification that dispatches an email with a link to click and verify the account and to continue the template/themes do not load and just loads the text that is generated from the system to populate the template/theme.

the first form function

Code:
function NewUserFormA()
    {
        $this->themechooser->GetTheme();        

        $this->load->helper(array('form', 'url'));
        $rules['username'] = "callback_username_check|required|min_length[5]|max_legnth[12]|xss_clean";
        $rules['password'] = "required|matches[password1]|md5";
        $rules['password1'] = "required";
        $rules['email'] = "required|matches[email1]|valid_email";
        $rules['email1'] = "required";
        $rules['fname'] = "required|xss_clean";
        $rules['lname'] = "required|xss_clean";
        $rules['street'] = "required|xss_clean";
        $rules['city'] = "required|xss_clean";
        $rules['state'] = "required|xss_clean";
        $rules['zip'] = "required|xss_clean";
        $rules['tos'] = "required";
        $fields['username'] = "Username";
        $fields['password'] = "Password";
        $fields['password1'] = "Password Retype";
        $fields['email'] = "Email";
        $fields['email1'] = "Email Retype";
        $fields['fname'] = "First Name";
        $fields['lname'] = "Last name";
        $fields['street'] = "Street";
        $fields['city'] = "City";
        $fields['state'] = "State";
        $fields['zip'] = "Zip Code";
        $fields['tos'] = "Terms of Service";
        if($_SERVER['REMOTE_ADDR'] == '10.0.0.21'){
            $this->validation->set_rules($rules);
            $this->validation->set_fields($fields);            
            $data['captcha'] = 'not required';
        }
        else{
            $rules['recaptcha_response_field'] = 'required|callback_check_captcha';
            $fields['recaptcha_response_field'] = "Captcha Image Verification";        
            $this->validation->set_fields($fields);
            $this->load->library('recaptcha');
            $data = array(
              'captcha' => $this->recaptcha->recaptcha_get_html()
            );
            
            $this->validation->set_rules($rules);
    
            // Function to check to see if captcha is correctly submitted
            
            function check_captcha($val) {
              $this->recaptcha->recaptcha_check_answer($_SERVER["REMOTE_ADDR"],$this->input->post('recaptcha_challenge_field'),$val);
              if ($this->recaptcha->is_valid) {
                return true;
              } else {
                $this->validation->set_message('check_captcha','Incorrect Security Image Response');
                return false;
              }
            }
        }
        $this->validation->set_error_delimiters('<div class="error">', '</div>');
        if($this->validation->run() == FALSE ){
            $this->load->view('reg/forma',$data);
        }
        else{
            $this->Proc_New1();
        }
    }
That works

This doesn't
Code:
function authenticate(){
        $this->themechooser->GetTheme();        
        $id = $this->uri->segment(3);
        $hash = $this->uri->segment(4);
        $query = $this->db->query("SELECT * FROM users WHERE id='". $id ."' AND reg_hash='". $hash ."'");
        if($query->num_rows() == 1){
            $row = $query->row_array();
            $str['active'] = 'yes';
            $str['lvl'] = '2';
            $this->db->where('id',$id);
            $this->db->update('users',$str);
            $data['base'] = base_url();
            $data['msg'] = "Okay Continue";
            $data['login'] = base_url().'auth/login';
            $this->parser->parse('reg/continue',$data);
            
        }else{
            $data = array(
                'header' => "Error!",
                'msg' => 'Some problems came up, either you waited to long and your account was removed or the link is invalid',
                );
            $this->parser->parse('reg/problem',$data);
        }
    }

Using the same function from my class/library that is loaded and working to get the template to use.

Any Ideas why it does not work on the second one?


Functions Do Not Load Correctly? - El Forum - 06-25-2008

[eluser]amw_drizz[/eluser]
Okay something interesting I found will experimenting some more.

in my ThemeChooser.php file

if I change this

Code:
$CI->parser->parse($ThemePath.'header', $data);
$CI->load->view($ThemePath.'left_bar');

to this
Code:
echo    $CI->parser->parse($ThemePath.'header', $data, TRUE);
echo    $CI->load->view($ThemePath.'left_bar',TRUE);

it will load the views/parse my templates on the pages that it is not loading. but it will not load certain css attributes. IE text formatting / placement.