Display dynamic menu and menu display rolewise login in Codeigniter |
hello everyone i need help in codeigniter dynamic menu, here i shown my two table 1st is category and 2nd is user_registration,
so here i want to display menu rolewise login suppose 1st is admin so admin will shown all menus, and 2nd is user so here i want to display them only 1,2 and 6 menu, here two tabel give cid is foriegn kesy, so how to join this table and how to disple menu userwise login so how to impelment in codeigniter give me hint *Category cid cname parentID 1 Home 0 2 Marketing 0 3 Customer 2 4 Quoation 2 5 New Customer 3 6 view Customer 3 *user_registration userid roll_id fullname username password cid 1 1 admin [email protected] admin 1,2,3,4,5,6 2 2 user [email protected] user 1,2,6 PHP Code: $categories = explode(',', $user->cid); Is that what you mean?
(07-23-2018, 03:05 AM)Pertti Wrote:yes got it but i did not fetch id in this condition(07-23-2018, 02:04 AM)jaydevvara Wrote: i did not understand Code: where_in('cid', $categories)
(07-23-2018, 03:08 AM)jaydevvara Wrote:(07-23-2018, 03:05 AM)Pertti Wrote:yes got it but i did not fetch id in this condition(07-23-2018, 02:04 AM)jaydevvara Wrote: i did not understand And here is my category table fetch query so how implement in this code public function listMenuLevel1() { $this->db->select("*"); $this->db->where('parent_id=0'); return $this->db->get('category')->result(); return result; } public function listchildMenus($category_id) { $this->db->select("*"); $this->db->where('parent_id', $category_id); return $this->db->get('category')->result(); return result; }
There are some good replies on recursively fetching parent entries here - https://stackoverflow.com/questions/2021...sive-query
(07-23-2018, 03:48 AM)Pertti Wrote: There are some good replies on recursively fetching parent entries here - https://stackoverflow.com/questions/2021...sive-query Thank you sir ![]() |
Welcome Guest, Not a member yet? Register Sign In |