[eluser]piker[/eluser]
All previus conception are good but only one row
can be viewed.
I found solution in the Internet.
Let in the model be somthing like this:
Code:
function get_latest_news()
{
$this->db->orderby("id", "desc");
return $this->db->get('newsy', 10);
}
Let in controller be something like this:
Code:
function index {
$this->load->model('News');
$query = $this->News->get_latest_news();
if ($query->num_rows() > 0)
{
$this->load->view('......', array('result' => $query->result()));
}
Let in views be something like this:
Code:
<html>
<?PHP
foreach($result as $val)
{
echo $val->news_title;
echo $val->news_text;
}
?>
</html
What are you thing about this conception?
It's possible don't use foreach loop in views?
My answer is NO.
Clear separation MVC is not possible.