![]() |
Suggestion building multiple used HTML Construct in Views - 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: Suggestion building multiple used HTML Construct in Views (/showthread.php?tid=58975) |
Suggestion building multiple used HTML Construct in Views - El Forum - 08-10-2013 [eluser]Publisher1[/eluser] What do you suggest. Situation 1: 1. Get DB Datas with the Model 2. Build the HTML Construct in thad Model method, with a parameter to return only Array or HTML constcuction - Contra: HTML in Model 3. So we can output this smart in multiple views: - Pro: smart identical codes in multiple views Like: Model: Code: public function getObjects($i_user_id, View: Code: if(!empty($objects)) { Situation 2: 1. Get DB Datas with the Model 2. Build the HTML Construct in the view and iterate through the array for construct the HTML - Pro: No HTML in the Model 3. Construct same HTML in the Views: - Contra: Identical big codes in multiple views Model: Code: public function getObjects($i_user_id) { View: Code: if(!empty($return_array)) { Suggestion building multiple used HTML Construct in Views - El Forum - 08-22-2013 [eluser]Publisher1[/eluser] My solution: i am loading a new view with the big HTML construct, into my views that i need. View in view |