[eluser]Werner85[/eluser]
Hello all!
I've been playing with Codeigniter for some time and I ran into some questions...
For example: Creating a navigation menu (UL > LI) on my site >
I found a tutorial on a site which explained to put the complete menu in a variable and send it to the view.
Is this ok? Because I always thought you had to put most of your HTML in your view instead of helpers.
I now did the following in my Menu helper:
Put each anchor in an array and send it back to the view using the main controller. Then I use a foreach in the view to generate the <li> items with the anchors in them.
Generating the complete menu in the helper cleans up the view a lot, but when I want to change the layout I will have to edit the view AND the helpers...
Now on to a bigger problem... I also have to generate 3 tables with orders. New, Paid and Sent orders. All 3 tables are the same except the content and the paid and sent status.
I already created the model for it which has the following function to get the database content:
Code:
function getNew() {
return $data = $this->_getOrders(0);
}
function getPaid() {
return $data = $this->_getOrders(1);
}
function getSent() {
return $data = $this->_getOrders(2);
}
Again I use this data in the view using a foreach loop. But now my view ended up with 3 foreach loops and 3 times the same table html code. Which looks really messy. Just because I try to keep the HTML separate from the PHP code according to the MVC standard.
Can anyone tell me what's ok and what's not?