Is this proper use of mcv? |
[eluser]Unknown[/eluser]
This is some stupidly easy code but since I'm new to MCV, I just wanted to check if this is proper use of MCV before I write lots of lines. Thanks a lot Model: Code: <?php Controller: Code: <?php view: Code: <html>
[eluser]brianw1975[/eluser]
that's pretty much it. some would go further and say to put the code that generates the navigation html into the view i.e: use php code in the view file that is basically the interior of the format function. this is covered in the User Guide Views chapter
[eluser]jdfwarrior[/eluser]
Looks good. Just as a hint though, and this isn't something thats required obviously, but longer named items such as your Navigation_model, you can get a simpler name by giving a second parameter when you load it. Code: $this->load->model('Navigation_model', 'nav'); Would allow you to access it via: Code: $this->nav->function() Like I said, not something major, just something I like to do to save time from typing long names and keeps me from making so many dang typos by having to type the long names.
[eluser]gyo[/eluser]
You could even put the navigation in a separate view file (to keep the main template clean). |
Welcome Guest, Not a member yet? Register Sign In |