I have main controller, that print main page.
<?
class Main extends Controller {
function Main()
{
parent::Controller();
$this -> load -> helper('date');
}
function index()
{
$this -> load -> view('header');
$this -> load -> view('main');
$this -> load -> view('footer');
}
}
?>
And I have controller of articles, that print 6 last articles.
<?php
class Articles extends Controller
{
function Articles()
{
parent::Controller();
}
function top()
{
$this -> db -> limit(0, 6);
$query = $this -> db -> get('articles');
$data['articles'] = $query -> result();
$this -> load -> view('articles-top', $data);
}
?>
Header view looks like this:
<html>
<head>
...
</head>
<body>
<div id="last-articles">
<!-- Here I want print last 6 articles -->
</div>
<div id="content">
How can I print last articles in header view?