Created
February 3, 2011 11:05
-
-
Save jlebrech/809354 to your computer and use it in GitHub Desktop.
in the model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function save($id=null) | |
{ | |
$this->title = $this->input->post('title'); | |
$this->code = $this->input->post('code'); | |
$this->permalink = $this->input->post('permalink'); | |
if ($this->input->post("id")){ // is there an id | |
$this->modified = date('Y-m-d H:i:s'); // then it's modified | |
$this->db->update('pages',$this, array('id'=>$this->input->post('id'))); | |
} else { | |
$this->created = date('Y-m-d H:i:s'); // then it's created | |
$this->modifed = $this->created; | |
$this->db->insert('pages',$this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment