[eluser]minimal design[/eluser]
A good way to get started is to download other people script and analyze them... MVC was a little confusing for me to at first... just keep going at it and at some point it will "click."
Basically, for your scenario, you can use a view for header, nav, footer, news content, and product description.
The header, nav, footer will be almost static plain PHP files, while your news and description views will have variables that will be replaced by data assigned to those variables by the controller. Sor for the news, your new model will get the news content from the database, then your news controller will pass that data to the news view.
This is super simplified and is just to give you an idea of the "flow"
model:
Code:
function get_single($article_uri) {
$this->db->where('uri',$article_uri);
$query = $this->db->get($this->articles_table, 1);
if ($query->num_rows() == 1) {
$article = $query->row_array();
return $article;
} else {
return false;
}
}
controller:
Code:
function read($article_title) {
$data['article'] = $this->articles_model->get_single($article_title);
$this->load->view('header', $data);
$this->load->view('article_single');
$this->load->view('footer');
}
view:
Code:
<h2><?= $article['title']; ?></h2>
<div class="body">
<?= $article['body']; ?>
</div><!-- .body -->
If you need 2 sets of data , just retrieve it with 2 models, load both in your controller and you'll have both sets of data available in your (single) view.
Hope that helps...