Welcome Guest, Not a member yet? Register   Sign In
Best way to project, plan and structure an app with CI


from which side do you start building and app?

I mean
given that you already know which the users areas and interactions are and also you already have structured the DB,

do you start with empty controllers and views setting up the navigation and routes?
Or what?

Thank you for sharing your approach


Hi, usually I start with weak (simple) entities from the database, creating its models and domain classes.

Then I start creating controllers with empty methods (future implementation) to build like a skeleton, in other words, what will be the controller responsibilities, or "actions".

Then views... HTML markup

Oh, along with these activities I'll certainly create some core files like MY_Controller, MY_Model and MY_Log, because I have own stuff inside these files.


That's a loaded question. There are so many approaches that can be taken. I like to have complete documentation/screen flow of how the whole application will function (including features) and work (this also includes the baseline database and all tables).

I'll try not to get to wordy...

One approach I take,
A. I create all the screens in html/js/css (I usually use a free bootstrap theme such as https://github.com/ColorlibHQ/gentelella )
- I then determine the default screens and how I can make useful reusable view parts (i.e. header and footer views).
B. I then determine the security approach and levels that will be used throughout the system (user/administrator access)
B. I then determine how I will create models. I prefer to create models to do specific things that can be reused throughout the system.
- for example...Userexist()
C. I then begin to code moving forward with the first screen and attaching all necessary code behind.

Likewise similar to php_rocs I use a top down approach working from the screens
back down into the app step by step defining the problems to be solved.

The screens can tell you a lot about the app for declaring variables etc;

These will also map into your models and controllers.

keep in mind KISS and DRY (Keep it simple stupid and do not repeat yourself).
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )



Very good thread!

I‘m not sure how to start the best way. As many people would say ... it depends ;-)
But I would say ... first I create the header file to implement bootstrap, jquery and custom webfonts.
Then I create the most important and nessecary model(s) and controller(s) < first model, then controller to load a first view and provide data to it. Mostly the view just displays a list of loaded items.
Then I build another view to show details of one item. Often this is a form so that I could build some edit functionallity extending to CRUD (create, read, update, delete).
After that i want to make it look nice. So I tweak the css (scss). Now ... display-filters for the list. So some jQuery scripting :-)
If there should be users I would build the login now, also with session-management. Just the login, not the whole registration and forgot-password-stuff.

Before the software grows, I also try to build repeating view-parts to be flexible.

My approach is top down and to create the basic tree menu system ensuring stylesheets and JavaScript files are all included.

I also use this common footer which consists of two w3.org validation service links. This dynamic script saves opening, copying, pasting, testing, the same links umpteen times.

PHP Code:

  $vEnc   urlencode ($url) ;

  $vCss   '<a href="'
          .   'https://jigsaw.w3.org/css-validator/validator?uri='
          .     $vEnc
.   '&profile=css3svg&usermedium=all&warning=1&vextwarning=&lang=en"'
          '>CSS: Validator'

  $vHtml  'https://validator.w3.org/nu/?doc=' .$vEnc ;
  $vHtml  '<a href="' .$vHtml .'"> HTML: Validator </a>' ;

/* style.css 
  .bot {border: solid 1px #ccc;}
  .fll {float: left;} 
  .flr {float: right;}
  .fss {font-size: small;} 
  .ftr {position: fixed; left:0; bottom:0;} 
  .tac {text-align: center;}
  .w99 {width: 100%;}

  echo $ftr = <<< ____EOT
    <p> <br> </p>

    <div class="ftr tac w99 fss">
      <b class="fll"> 
$vHtml </b>
      <b class="flr"> 
$vCss  </b>

      Wonderful place for a footer

Before everything I create a new Word file to note down & follow the "to do list" of the project. When I complete a task, I strikethrough it, I also write down any link of any forum help or a link of a video etc. Then the work takes control of me and the work itself in a proper way.

And I continue by doing it one by one, seeing the result of each section, of course by copying some parts from the previous jobs. This might lead to getting stucked to a point until you solve it. (Because I spend a lot of time searching for a solution. I rarely ask for help)

I do it this way:

1) I think about, what kind of data I want to show
-> I get my routes

2) I desgin my views.

3) 2) results in my database structure and via normalizing I get the correct "joins" for later.
I can structure my model.

3) By 1) I can structure my controller.
Do I need arguments? Where do they come from? What if an error occurs? How to handle it?

4) After my application is done I clean up my code.

Instead of writing over and over again sth. like


I do sth like this:

protected $model = 'mymodel';

And then I can use


just in case I have to edit "mymodel" for what reasons ever and with this way I am sure not to forget one.

But this is not really neccesary. Someone could use "search and replace" instead.


1- I start with all the Software Engineering.

2- Create the database.

3- Extend the CI_Model and CI_Controller.

4- Work on Model and Controllers

5- Work on views.

I do it this way because I have from the SE all the prototypes of every Use Case, and I prefer to go from the complex to the simplest. I also follow the KISS and DRY philosophy XD

Theme © iAndrew 2016 - Forum software by © MyBB