2015-11-04 62 views
0

首先,我的計劃是製作一個能夠讀取html元內容的php代碼內容並將其發送到html標題的庫。CodeIgniter - 如何使函數擴展幫助器?

而就在數天前,我發現笨已經工作有關的meta標籤和我的計劃變更......

現在如何讓我的圖書館擴展這個網站助手這樣

class Htmlplus extends CI_html { 

    public function show(){ 
     //show html header 
    } 

} 

回答

0

難道你檢查了文檔?

http://www.codeigniter.com/user_guide/general/helpers.html#extending-helpers

或者你尋找一些其他的解決辦法?

編輯在擴展的輔助使用輔助功能評論#1

是相同的方式,你會做任何其他地方。只需使用它們(確保,幫手已加載)

例如在文件應用程序/傭工/ MY_url_helper.php你可以使用錨()

function helper_test($str) { 
    return anchor($str, 'test'); 
} 
+0

沒關係,文檔沒有解釋如何訪問父功能。例如:我打算使用''link_tag「來加載來自pages.php和/或''meta'的數據加載來自同一位置的數據。我如何執行這些事情。 –

0

創建CI和負載幫手的一個實例! class Htmlplus extends CI_html {

public function show(){ 
     //show html header 
     $ci = & get_intance(); 
     $ci->load->helper('myhelper'); 
     myfunction(); 
    } 

}