Welcome Guest, Not a member yet? Register   Sign In
he best structure for a site with admin area
#1

[eluser]artificialkid[/eluser]
Hy, I already post this question , But I´m still without a good awnser.

What do you guys think is the best file structure with CI for a site with adm area, should i have 2 system folders, I would like to separate things the public site from d adm.

tnaks
#2

[eluser]Michael Wales[/eluser]
I wouldn't make 2 system folder. I would merely make a controller for administrative functions and a controller for normal users / public access.
#3

[eluser]artificialkid[/eluser]
HY,

I dons´t know if I understand you, the adm must be a part of the site with an interface, login etc
#4

[eluser]Michael Wales[/eluser]
I know - Controllers are Code Igniters way of receiving the users input/request and "controlling" how the application performs. They are kind of the traffic police between your application, the database, and your user's screen.

Head over to the User Guide and familiarize yourself with CI a bit more.

CodeIgniter At a Glance
Application Flowchart
Model-View-Controller
Controllers
#5

[eluser]artificialkid[/eluser]
Hy, I already read it,


www/site
www/site/adm

let me try to explain better, imagine wordpress, this is what i want with CI, a static and dynamc pages and the admin area.
#6

[eluser]Michael Wales[/eluser]
and that's what I am telling you - 2 controllers

Code:
class Front extends Controller() {

  function index() {
    // Hey, here's the front page
  }

  function post() {
    // Hey, reading a post
  }

  function comment() {
    // Hey, processing a comment form
  }

}

Code:
class Admin extends Controller {

  function index() {
    // Yoho, checking if we're logged in
  }

  function cpanel() {
    // Yoho, we're logged in - do some managing
  }

  function write() {
    // Makin' posties!
  }
}

In this example, you would set your default controller to 'Front' therefore front/index would load when people visited your domain - all of the other methods within Front would be accessible at domain.com/front/[insert method]

All of your admin methods would be accessible at domain.com/admin/[insert method]

With some URI Routing you can remove the /front/ controller from the URL to make it a bit cleaner.
#7

[eluser]esra[/eluser]
There are all sorts of solutions for handling complex admin scenarios where many controllers are required to administer your frontend. Most users here appear to be designing fairly small applications, although this is not always the case.

For earlier applications, I used one system/ directory and moved application/ to the same directory level as system/. Under application, I created one subdirectory called admin/ and another called domain/. Subdomains and other domains can be created in other directories under application/. I copied the original application folders to domain/ and moved the original application folders to admin/. Then make a copy of index.php and rename it to admin.php. For each of the two applications, set the base_url to access the applicable paths under application. In index.php and admin.php, leave the system path set to system if you do not change the name and change the new directory path for admin and domain in your application path variable. Leave the session table and cookie names the same in both config.php files. Use a single database and share the tables among the two applications.

Note that the above is not the only solution. You might try doing some research by doing forum searches using the 'admin' keyword.

If you are accustomed to using Wordpress, you might want to look at Zacarias' Modular Separation extensions which allow you to support modules with module-specific code stored in their own directory structures.
#8

[eluser]esra[/eluser]
Bizarre repeat??
#9

[eluser]artificialkid[/eluser]
Hy, thanks to yuo all, I think for me knoe this is the more "logical " way.
#10

[eluser]isabelle[/eluser]
walesmd > your point of view and the way you're coding are very interesting, in which cases would it be interesting to use subfolders? (for the code, i mean not for images,css).

As i'm beginning an admin area, i'm gonna delete my subfolders so ^^




Theme © iAndrew 2016 - Forum software by © MyBB