CodeIgniter Forums
Suggestions for application development method - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Suggestions for application development method (/thread-24390.html)



Suggestions for application development method - El Forum - 11-09-2009

[eluser]liri[/eluser]
Hey,

I decided to use CI for a new application I'm working on and I will welcome any pointers in guiding me towards the best approach, as I have some dilemmas regarding a couple of things.

First problem I'm facing is this - the app's navigation is 2 degrees, so I have categories and sub categories such as:

* Application
* Reports
* Management
* Configuration
* DB
* Language

I decided to start first with the Configuration part which doesn't encompass a whole lot of stuff and created a controller directory for it. For views - I wanted it to be really modular so I've broke it down into header.php, footer.php, etc... and put it in views/template/header.php etc...

Now, for the "index" page of the Configuration page I'm doing something like:

Code:
...
    private $__menuCategory = "Configuration";
...
    function index()
    {
        $menu['menuCategory'] = $this->_getMenuCategory();
        
        $this->load->helper('url');
        $this->load->view('template/header.php');
        $this->load->view('template/menu.php', $menu);
        $this->load->view('template/main.php');
        $this->load->view('template/footer.php');
    }

And in the menu.php view I'm checking which page is it to draw the specific category link in bold for example.

Question is - now to proceed with the view for the subcategory "DB" should I have another funtion db() for it and perform the same load->view() methods?


I'm not sure this is the proper way to do things, with procedural code these things are obviously alot simpler and I'd appreciate some feedback on how to continue.


Thanks.


Suggestions for application development method - El Forum - 11-10-2009

[eluser]imn.codeartist[/eluser]
not need to give .php extension while loading views

Code:
$this->load->view('template/header.php');

instead of

Code:
$this->load->view('template/header');
is just fine


Suggestions for application development method - El Forum - 11-10-2009

[eluser]liri[/eluser]
Thanks for the comment, though not exactly my interest of feedback
but note taken.


Suggestions for application development method - El Forum - 11-10-2009

[eluser]imn.codeartist[/eluser]
can't you have all views in one page like master page


Suggestions for application development method - El Forum - 11-10-2009

[eluser]jedd[/eluser]
I think you should read [url="/wiki/Header_and_Footer_and_Menu_on_every_page_-_jedd/"]this wiki page[/url]. I think it's a neater approach to the one you're using here, and might answer some of the other questions you have (or are about to have).

Note that template isn't quite a reserved word, but has certain specific meanings to different people in the CI context.