![]() |
Help me to use lib parser of CI - 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: Help me to use lib parser of CI (/showthread.php?tid=12744) |
Help me to use lib parser of CI - El Forum - 10-29-2008 [eluser]mhungou04[/eluser] Hi this is some code in my controller. I user class parser as Code: $query = $this->db->get('product'); So in my view.html i write Code: {product} But now when deverlop my application there was a problem. When i code function update. I have list box containing list of category. I can load data from db but i cant do this Code: <option value = "abc" selected>abc</option> This is code in viewer. Code: {product} Help me to use lib parser of CI - El Forum - 11-03-2008 [eluser]mhungou04[/eluser] I ve got a solution for this problem but it s not nice. In my controler: $query = $this->db->get('product'); $data['product'] = $query->result_array(); $query1 = $this->db->get('category'); $data['category'] = $query1->result_array(); $this->parser->parse($data,'view.html'); and in my view: {product} //do some thing... <select name = 'cat_id'> <option value={cat_id} select = "selected">{cat_name}</option> {/product} {category} <option value={cat_id} select = "selected">{cat_name}</option> {/category} </select> Any one can do better than me. Plz give me some advice |