El Forum
01-10-2010, 01:56 PM
[eluser]dadamssg[/eluser]
Im just trying to display one row of information on a page and i keep getting a 404.
I'm using an 'events' controller and im trying to pull the second segment of the uri as the event id number to query.
heres my event controller
and heres my view
i think i need to change that foreach thing because im only dealing with one row
my head_view just opens up the html
Im just trying to display one row of information on a page and i keep getting a 404.
I'm using an 'events' controller and im trying to pull the second segment of the uri as the event id number to query.
heres my event controller
Code:
class Events extends Controller {
function Events()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('date');
$this->load->helper('text');
$this->load->helper('form');
$this->load->library('session');
$this->load->model('Eventmodel');
}
function index($id = null)
{
//load models
$newdata = array(
'page' => 'mains',
);
$this->session->set_userdata($newdata);
$data['title'] = "Home";
$data['heading'] = "All Events";
$page = $this->uri->segment(2);
if (isset($page) && is_numeric($page))
{
$page = $page;
}
else
{
$page = 867;
}
$data['query'] = $this->Eventmodel->get_event($page);
$this->load->view('header_view', $data);
$this->load->view('event_view', $data);
}
}
and heres my view
Code:
<?php
session_start();
?>
<?php foreach($query->result() as $row): ?>
<h3><?php echo clean_up($row->title); ?></h3>
<?php echo easy_date($row->start); ?> -
<?php echo easy_date($row->end); ?>
<p>
<?php echo clean_up($row->description); ?>
<h5><?php echo "By ".$row->createdby; ?></h5>
</p>
<hr>
<?php endforeach; ?>
</body>
</html>
my head_view just opens up the html
Code:
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html >
<head>
<link rel='stylesheet' type='text/css' href='silk.css' />
<title> <?=$title?> </title>
</head>
<body>
<h1><?=$heading?></h1>
<hr>
<ul>
<li><?=anchor('mains', 'Home')?></li>
<li><?=anchor('mains/sports', 'Sports')?></li>
<li><?=anchor('mains/performance', 'Performance')?></li>
<li><?=anchor('mains/organization', 'Organization')?></li>
<li><?=anchor('mains/random', 'Random')?></li>
</ul>
<hr>