I'm looking to add a blog to my portfolio website. Right now the website is a simple codeigniter website. I'd like to not have to move from codeigniter, and I'd prefer not to use wordpress.开发者_如何学编程 What are some good options? Are there any "bolt on" type options that I can make match the style of my existing website?
You probably will have trouble finding a "bolt-on" blog for Codeigniter.
Writing very basic blog software is quite easy, as demonstrated by the (dated) "Build a blog in 20 minutes" video on the home page. Of course, it's not going to really be come together in 20 minutes, but you get the idea. Not only that, writing it yourself is supposed to be the fun part!
If you aren't interested in writing one yourself, and don't want to use Wordpress, have a look at PyroCMS. Extendable, customizable, built with CI, and it's got a blog :) Of course this is a full featured CMS, and not a drop in. You would have to convert your whole site to use it.
If this is too much hassle, you can still dissect the blog module they use and convert it to work with your environment, or simply learn a thing or two from it on how to handle writing your own.
its difficult to integrate PyroCMS to existing system, you may have some luck in integrating your existing code into pyrocms ;)
btw if you are looking for some jump start , you can use the model I had written some time ago.( very much incomplete )
<?
class Crapcms_posts extends CI_Model {
function __construct()
{
parent::__construct();
}
function getIndexPosts(){
$data = array();
$this->db->where('status', 'published');
$this->db->order_by("pubdate", "desc");
$query = $this->db->get('posts',10);
if ($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$data[] = $row;
}
}
return $data;
}
function getAllPosts(){
$data = array();
$this->db->order_by("pubdate", "desc");
$query = $this->db->get('posts',10);
if ($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$data[] = $row;
}
}
return $data;
}
function getPage($x){
$data = array();
$this->db->where('status', 'published');
$this->db->order_by("pubdate", "desc");
$query = $this->db->get('posts',10,$x);
if ($query->num_rows() > 0){
foreach ($query->result_array() as $row){
$data[] = $row;
}
}
return $data;
}
function getPost($id){
$data = array();
$this->db->where('permaurl',$id);
$this->db->limit(1);
$query = $this->db->get('posts');
if ($query->num_rows() > 0){
$data = $query->row_array();
}
return $data;
}
function addPost(){
$title = $this->input->post('title');
$permaurl = url_title($title);
$tags = $this->input->post('tags');
$status = $this->input->post('status');
$body = $this->input->post('body');
$category_id = $this->input->post('category_id');
$date = date('Y-m-d H:i:s');
$this->db->set('title', $title);
$this->db->set('permaurl' , $permaurl);
$this->db->set('tags', $tags);
$this->db->set('status', $status);
$this->db->set('body', $body);
$this->db->set('category_id', $category_id);
$this->db->set('pubdate', $date);
$this->db->insert('posts');
}
function editPost(){
$data = array(
'title' => $this->input->post('title'),
'tags' => $this->input->post('tags'),
'status' => $this->input->post('status'),
'body' => $this->input->post('body'),
'category_id' => $this->input->post('category_id'),
'user_id' => $_SESSION['userid']
);
$this->db->where('id', $this->input->post('id'));
$this->db->update('posts', $data);
}
function deletePost($id){
$this->db->where('id', $id);
$this->db->delete('posts');
}
}
?>
精彩评论