Welcome Guest, Not a member yet? Register   Sign In
Just starting, important question.
#1

[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?
#2

[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()
{
//do something...
$this->load->view('page1_view');
}

function2()
{
//do something...
$this->load->view('page2_view');
}
#3

[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() {
  // Code to display the newlist
}

So when I come to do mysite.com/admin/news/edit/5, where would I have put the news_edit function?
#4

[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
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB