2011-07-14 38 views
0

我正在尋找添加博客到我的投資組合網站。現在這個網站是一個簡單的codeigniter網站。我不想從codeigniter,我寧願而不是使用wordpress。有什麼好的選擇?是否有任何「螺栓」類型的選項,我可以匹配我現有的網站的風格?我的博客添加到現有codeigniter網站有什麼選擇

+0

我的計劃是一樣的,我會去找一個自定義的發帖系統,並通過Disqus發表我的意見。無論如何,有很多教程用於在那裏建立基本的博客。 –

+0

@Catfish:有什麼理由不能使用CodeIgniter自己創建你需要的東西?在CodeIgniter.com主頁上有一個「[在20分鐘內構建博客](http://codeigniter.com/tutorials/watch/blog/)」教程。 –

+0

是的,我可以建立一個,但我有一些網站(不是所有的CI),希望在事後添加博客。我一直在尋找是否有一個好的「一刀切」解決方案。 – Catfish

回答

2

您可能很難找到Codeigniter的「螺栓連接」博客。

編寫非常基本的博客軟件非常簡單,正如主頁上的(註明日期)「在20分鐘內構建博客」視頻所示。當然,這不會在20分鐘內真正在一起,但你明白了。不僅如此,自己寫它應該是有趣的部分!

如果你不想自己寫一個,也不想使用Wordpress,看看PyroCMS。可擴展,可自定義,使用CI構建,它有一個博客:)當然,這是一個全功能的CMS,而不是一個下拉菜單。您必須轉換整個網站才能使用它。

如果這太麻煩了,你仍然可以剖析他們使用的博客模塊,並將其轉換爲適用於你的環境,或者直接從它學到一些東西來處理你自己寫的東西。

1

其難以整合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'); 
} 
} 
?> 
相關問題