07-27-2011, 05:41 PM
[eluser]BenSeagrave[/eluser]
I'm trying to implement a blog like feature to my website. I have inserted dummy data into my database and set up the config files in codeigniter. If you go to http://pheonixstudios.co.uk/site you can see the error that I am getting.
This is my controller :
and this is the part of the home_view.php file you will need to see:
This is also the model:
I'm trying to implement a blog like feature to my website. I have inserted dummy data into my database and set up the config files in codeigniter. If you go to http://pheonixstudios.co.uk/site you can see the error that I am getting.
This is my controller :
Code:
<?php
class Site extends CI_Controller
{
public function index()
{
$data = array(
'pageTitle' => 'Home',
'main_content' => 'home_view',
'bannerText' => 'Pheonix Studios'
);
if($query = $this->site_model->getRecords())
{
$data['records'] = $query->result();
}
$this->load->view('includes/template', $data);
}
}
?>
and this is the part of the home_view.php file you will need to see:
Code:
<div id="primary" class="grid_15">
<?php foreach($query->result() as $row): ?>
<article>
<h3><?=$row->title?></h3>
<strong><p class="articleDate">Posted on <?=$row->date_created?></p></strong>
<p><?=$row->body?></p>
</article>
<?php endforeach; ?>
</div>
This is also the model:
Code:
<?php
class Site_Model extends CI_Model
{
function index()
{
}
function getRecords()
{
$query = $this->db->get('blogEntries');
return $query->result();
}
}
?>