Welcome Guest, Not a member yet? Register   Sign In
Suggestions for application development method
#1

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

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

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

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

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




Theme © iAndrew 2016 - Forum software by © MyBB