什么是我的选择添加博客到现有的codeigniter网站


What are my options for adding a blog to an existing codeigniter website

我想添加一个博客到我的投资组合网站。现在这个网站是一个简单的编码器网站。我不想从codeigniter移动,我更喜欢而不是使用wordpress。有什么好的选择吗?是否有任何"螺栓"类型的选项,我可以使匹配我现有的网站的风格?

你可能很难找到一个Codeigniter的"附加"博客。

编写非常基本的博客软件是相当容易的,如(日期)所示。主页上的"20分钟建博客"视频。当然,这不是20分钟就能搞定的,但你懂的。不仅如此,自己写应该是有趣的部分!

如果你对自己写一个不感兴趣,并且不想使用Wordpress,可以看看PyroCMS。可扩展,可定制,内置CI,它有一个博客:)当然,这是一个功能齐全的CMS,而不是一个偶然的。你必须转换你的整个网站才能使用它。

如果这太麻烦,您仍然可以分析他们使用的博客模块并将其转换为适合您的环境,或者简单地从中学习如何处理自己的编写。

很难将PyroCMS集成到现有系统中,您可能会幸运地将现有代码集成到PyroCMS中;)

顺便说一句,如果你正在寻找一些启动,你可以使用我之前写的模型。(非常不完整)

<?
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'); 
 }
}
?>