![]() |
controller/view/view - 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: controller/view/view (/showthread.php?tid=59294) |
controller/view/view - El Forum - 09-17-2013 [eluser]ZioN[/eluser] Hi there, Recently started with CodeIgniter and I like it. I am building myself a website but I have this issue and cannot find out how I should do it. This is the situation: I have an admin panel and a 'user' view. The url is looking like this: acp/users where acp is the controller and users is the view. On the users page I have a button with Add User, and I want this to point to acp/users/add_user. What's the best method of doing this? ~ Nick controller/view/view - El Forum - 09-17-2013 [eluser]noideawhattotypehere[/eluser] Code: anchor('controller/method', 'Add User', array(class="your-button-class")); controller/view/view - El Forum - 09-17-2013 [eluser]ZioN[/eluser] Perhaps I did not explain my question thoroughly. My setup: acp/users acp is the controller and users is the view. The users view is a default page with some general information. On that page I have a little menu with "Add user". I want this to point to acp/users/add_user and I want that page to display my form. How do I add that last part (add-user)? I tried several options (routes etc.) but I have not found a way to make that work yet. controller/view/view - El Forum - 09-17-2013 [eluser]noideawhattotypehere[/eluser] I kinda dont understand your app build. How do you call controller/view directly? Its controller/method, and method can load diffrent views. Maybe you should post your acp controller code. Im either tired or just simply we dont understand each other :p controller/view/view - El Forum - 09-17-2013 [eluser]ZioN[/eluser] I meant method indeed. My bad. Code: class Acp extends CI_Controller { After acp/users I want add_user which displays a form to add a user. controller/view/view - El Forum - 09-17-2013 [eluser]noideawhattotypehere[/eluser] Controller: Code: public function add_user(){ $route['acp/users/add_user'] = "acp/add_user"; Then you should be able to point to domain.com/acp/users/add_user and see your form. (located in views/acp/add_user_view.php) controller/view/view - El Forum - 09-17-2013 [eluser]ZioN[/eluser] Perfect! Thanks a bunch. |