[eluser]Matt Egan[/eluser]
It all depends for me. Sometimes, I have the HTML generated in the model. Other times, I do otherwise. But, anyways, for example, if I have a navigation list that I want to create. If I know, in all cases how its going to be formatted, I just generated the UL with the LI's inside, inside the model. Here's my code, this is in my model.
Code:
function pagenavigation() {
$this->db->order_by('Title', "DESC");
$query = $this->db->get('pages');
$result = "<ul>";
$result .= "<li><a >Blog</a></li>";
foreach($query->result() as $row) {
$result .= "<li><a >id."\"\\>".$row->navtitle;
$result .= "<li></a>";
}
$result.="</ul>";
$query->free_result();
echo $result;
}
I would use this in my view by...
Code:
$this->mymodel->pagenavigation();
And it would generate something like
Code:
<ul>
<li><a href="http://www.example.net/website/">Blog</a></li>
<li><a href="http://www.example.net/website/page/index/1">Page<li></a>
</ul>
Hope that helps, note that I only do this on special occasions, but I'm just showing you another way that you could go about things. Really, its all up to you, code is never set in stone, code however you like.