[eluser]draconus[/eluser]
I am trying to create a dynamic site as my first CI project, and I have already loaded the site table in my database up with all the data it needs to accomplish this task. here are the columns:
id, page, title, body, section
The page field is what i am using as the search term, since it will then display the page name in the url. The title is self explanatory and the body contains the body code. The section is the key that links this table to the sidebar table and loads the sidebar based upon section.
I created a model, a controller, and a view for this, but i cannot seems to get the query to run properly at all, since it seems to get stuck on it's way to the controller! The view just has echo tags for title, body, etc. so as simple as this is, I should have no issues outputting it if i get it to the controller. The data is being output to the following url:
/page/ (I did the whole no index page thingy, which works nicely)
My Model(Site.php):
Code:
<?
class Site extends Model {
var $page = 'Index';
var $title = '';
var $body = '';
var $section = '';
function Site(){
parent::Model();
}
function insert_entry(){
$this->page = $_POST['page'];
$this->title = $_POST['title'];
$this->body = $_POST['body'];
$this->section = $_POST['section'];
$this->db->insert('site', $this);
}
function update_entry(){
$this->page = $_POST['page'];
$this->title = $_POST['title'];
$this->body = $_POST['body'];
$this->section = $_POST['section'];
$this->db->update('site', $this, array('id' => $_POST['id']));
}
function display($page){
$this->db->select('*')->from('site')->where('page', $page)->limit(10, 20);
$query = $this->db->get();
}
}
?>
And my Controller(page.php):
Code:
<?
class Page extends Controller {
function index(){
$this->load->model('Site');
$data['query'] = $this->Site->display("index");
$this->load->view('page', $data);
}
}
?>