form not showing up? - 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: form not showing up? (/showthread.php?tid=52758) |
form not showing up? - El Forum - 06-25-2012 [eluser]solid9[/eluser] hello people The body_register_form.php is not showing up. I have these codes below, controller: method Code: //Register a new user view: create_user_form.php (template) Code: <div id="body1"> view: body_register_form.php Code: <h3><center>Register a new account.</center></h3> Hope someone will help me. Thanks in advanced. form not showing up? - El Forum - 06-25-2012 [eluser]CroNiX[/eluser] Probably, Code: <?php echo $this->data['rightnav']; ?> form not showing up? - El Forum - 06-25-2012 [eluser]solid9[/eluser] I will try that. form not showing up? - El Forum - 06-25-2012 [eluser]CroNiX[/eluser] Although I only see you set a 'header' and 'midnav' in your create_user() method. Unless you are setting 'leftnav' and 'rightnav' somewhere else, I don't see how they'd be available to your 'create_user_form' view. form not showing up? - El Forum - 06-25-2012 [eluser]solid9[/eluser] wow, it works. now can you explain that to me cronix. why is it the $rightnav and $leftnav work using this echo below, Code: echo $leftnav; and the $midnav won't? and why I needed this code before it will show up? Code: echo $this->data['midnav']; mmm, confusing... why? form not showing up? - El Forum - 06-25-2012 [eluser]CroNiX[/eluser] Because you assigned them to a class property ($this->data), not a regular array ($data). I have no idea why $leftnav and $rightnav would work. I don't see where you are setting them in the code you provided. form not showing up? - El Forum - 06-25-2012 [eluser]solid9[/eluser] Okay I put back the original code cronix, Code: echo $leftnav; I now saw the real culprit, Code: public function create_user() I added the Code: $this->data Anyway thanks to you CRONIX without you I will not see the real culprit. form not showing up? - El Forum - 06-25-2012 [eluser]CroNiX[/eluser] I'd leave it the way you originally had it (not explicitly passing $this->data to the view, but then using $this->data['var'] within the view to access the data). Your data already exists as a class property ($this->data), since that's how you assigned it. If you then pass it to the view as the 2nd parameter of load::view(), it will turn each one of those array pieces into a new variable via the extract() function, using basically twice the resources than if you didn't. Either that, or don't assign it to a class property and just use Code: $data['header'] = $this->load->view('header', $data, TRUE); |