![]() |
loading different module views into page virew. possible or quite wrong? - 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: loading different module views into page virew. possible or quite wrong? (/showthread.php?tid=32652) |
loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]shershen08[/eluser] if it's right desigion for my situation? i've got booking form on a page, wich user can fill in and press submit this form is made as a module and it has 3 views: form (empty form itself), success (when form is filled properly) and error (when some field are missing) it has it's own controller which validates the data and loads needed view BUT i've got one page template - say it's a view called "page_view" and in it i load my module as - modules::run('booking'), this case loads basic view of a module called form, but HOW CAN I CALL another views of a module form like success and error on the same page view? what construction i should use to make my module changing inside the same page view? i'am a newbie so probably this idea is urgly and wrong, than how should i do this? loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]Jan_1[/eluser] hope I have understood you and this might be a help: make a view_file with 3 cases (empty_form, success and error) pass a variable from controller_file to view_file which says what kind of view is needed. make form-validation in the controller_file if form-validation is ok, call function in model_file which writes input_data to database PS: if you like to: call form_fields from a function in model_file and pass it to view_file by controller_file loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]shershen08[/eluser] [quote author="Jan from Hamburg" date="1280494053"] make a view_file with 3 cases (empty_form, success and error) pass a variable from controller_file to view_file which says what kind of view is needed. [/quote] thanks for fast answer, but that's the obvious thing, which i wanted to avoid exactly i wanna have 1 view of the page and 3 views of a module is that possible? loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]shershen08[/eluser] [quote author="shershen08" date="1280496051"][quote author="Jan from Hamburg" date="1280494053"] make a view_file with 3 cases (empty_form, success and error) pass a variable from controller_file to view_file which says what kind of view is needed. [/quote] thanks for fast answer, but that's the obvious thing, which i wanted to avoid exactly i wanna have 1 view of the page and 3 views of a module is that possible?[/quote] oh, sorry let me think once again, probably i didn't get the idea loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]shershen08[/eluser] ok, now got it! i tried to do this way, but could not find information how to get paraveters inside view. in controller i call view like this - $this->load->view('booking', $params); than can you give me an example how i can get this $params inside view ? loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]Jan_1[/eluser] as fast/short as possible... Hope I made no mistakes ;o) Have a look in the manual, too, please form_controller.php Code: function my_form() form_model.php: Code: function write_to_database() form_view.php: Code: <?php you can also push your inputfields from controller Code: $data['fields']= "<input type='text' name='passconf' value='' size='50'/>etc etc all fields..."; Code: $data['input_username']=$this->form_model->inputfield_username(); loading different module views into page virew. possible or quite wrong? - El Forum - 07-30-2010 [eluser]shershen08[/eluser] it started working at last! thanks a lot! |