Administrative Area Controller Codeigniter

1

I'm developing a site with administrative area. I started it with the new version of Codeigniter 3.1.5. In the main pages would be body of the site, already in the news pages the url would look like this: www.exemplo.com/noticia/visualizar/id with controller news and the view function responding to url.

In the administrative page the link would be www.exemplo.com/admin with controller admin bringing the main page of the administrative area. From this URL the controllers add news, photos, etc. They should respond to url for example: www.exemplo.com/admin/noticia/adicionar with controller noticia being later than admin in the url. I thought of putting two frameworks in hosting one in the root folder and another in admin. But I do not think I'm the best. I read about extends class , but I do not know if I'm on the right track.

    
asked by anonymous 19.07.2017 / 21:46

1 answer

2

Do the following within the application/controllers ( folder using concept of controls in subdirectories via documentation ) create a folder with the name of admin , example application/controllers/admin , and now all controllers that are part of the administrative area make the file therein, example :

  

andtocallthispageinthebrowserdoso:

  

Thisalreadyguaranteesthenameoftheroute.Theotherfilescancontinueinthesameway,thatis,inthesamefolderapplication/controllers.

Thisprocessisalsogoodfororganizingyourcodebyseparatingwhatisadministrativeandwhatisforeveryonetoaccess.

Ifyouwanttocreateadefaultrouteforthisfolderitwillgointoapplication/config/routes.phpandaddattheendofthefilelikethis:

$route['admin']='admin/home/index';

WhenfallingonthepathadminwilldefaulttocontrollerHomeandmethodindex

19.07.2017 / 21:55