![]() |
Just starting, important question. - 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: Just starting, important question. (/showthread.php?tid=40161) |
Just starting, important question. - El Forum - 03-31-2011 [eluser]Arieskingdom[/eluser] Hi guys, know this might be a stupid question but hopefully someone can point me in the right direction. I downloaded CI, and installed it fine. I routed the frontend pages of my website through template.php, and all was working fine. The problem comes when I want to have an admin area to add, edit and delete news articles. I made an admin directory in views, and made an admin.php in controllers, and managed to make an admin system with a login page, dashboard and news page, which listed the news. My problem arose when I tried to make a news edit page. My news was all controlled through admin.php with a function called news, how was I to do another level in? My question to you is: What is the best way to do an admin system, would it be by using mysite.com/admin.php/news/edit/5? Hopefully I've explained myself well, if not let me know. Thanks Matthew Edit ---------- Shoud've searched first really.... Would it be fair to say I could just create a directory in my controllers called admin, and have functions for each page inside that? Just starting, important question. - El Forum - 03-31-2011 [eluser]SPeed_FANat1c[/eluser] "My problem arose when I tried to make a news edit page. My news was all controlled through admin.php with a function called news, how was I to do another level in?" what do you mean by another level? If you want to add functionality for new editing, then.. just add a fucntion in the controller for editing news. "and have functions for each page inside that?" yeah, you can have a function ofr each page, I don't see any problem. Code: function1() Just starting, important question. - El Forum - 03-31-2011 [eluser]Arieskingdom[/eluser] My layout was: - controller admin.php index.php - views - admin dashboard.php login.php news.php In controller/admin.php I had: Code: function news() { So when I come to do mysite.com/admin/news/edit/5, where would I have put the news_edit function? Just starting, important question. - El Forum - 03-31-2011 [eluser]SPeed_FANat1c[/eluser] If I were you - I would not make news as funcion, but make onother controller for news. In that controller you would have function edit. you can put admins controlers in some folder e.g. admin_, then to reach edit function you would go mysite.com/admin_/news/edit/5 Just starting, important question. - El Forum - 03-31-2011 [eluser]Arieskingdom[/eluser] [quote author="SPeed_FANat1c" date="1301605721"]If I were you - I would not make news as funcion, but make onother controller for news. In that controller you would have function edit. you can put admins controlers in some folder e.g. admin_, then to reach edit function you would go mysite.com/admin_/news/edit/5[/quote] Thanks, thats just what I was after, so I have controllers/admin/news.php and inside there, functions for each action I want to take. Thanks both of you, this can be closed now. |