前言介紹
- 這款 WordPress 外掛「Churro」是 2009-09-01 上架。
- 目前有 10 個安裝啟用數。
- 上一次更新是 2012-08-02,距離現在已有 4658 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 2.8.0 以上版本才可以安裝。
- 尚未有人給過這款外掛評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
內容簡介
Churro 是一款外掛,讓開發者可以輕鬆建立頁面和功能,類似於 CodeIgniter 的風格。但是單獨使用 Churro 不會在您的 WordPress 網站中新增任何功能。
已測試與 WordPress 及 WordPress MU 2.8.0 ~ 3.0.5。
需要 PHP 5,PHP 4 舊到已經是10年前的事了,您知道嗎?
Churro 基礎
= 網址 =
Churro 需要可讀性較高的網址,而非查詢字串。通常您的網址會製作成以下的映射:yoursite.com/class/method/variables
控制器
控制器會直接映射到相同名稱的檔案和類別。例如:
yoursite.com/contact
會尋找 /churro/ 目錄中名稱為 contact.php 的檔案,該檔案必須有一個延伸 Churro 類別且名稱為 contact 的類別。如果沒有定義的方法,將預設為 index。所有可以透過網址存取的方法都會附加 ‘Action’。以下程式碼提供 scaffolding 以供 yoursite.com/contact 和 yoursite.com/contact/submit 的使用:
class contact extends Churro {
public function indexAction(){
}
public function submitAction(){
}
}
模型
Churro 讓您可以透過 $this 關鍵字存取幾個重要的 WordPress 模型。不使用 global 關鍵字即可使用 $wp、$wpdb 和 $wp_query 類別,以及 MU 中的 $blog_id。
視圖
視圖屬於正常的佈景主題目錄。如果您使用多個佈景主題,您可以在控制器中使用 $this->Theme( 'directory-name' ) 覆寫目錄。要指定要使用的視圖,使用 $this->View( 'file-name' )。在 Churro 中,將邏輯與視圖分離是最重要的事情。要在您的視圖中設置變數,可以在控制器中使用 $this->vars->var_name,在您的視圖中使用 $var_name。
Ajax / Javascript
如果您使用優秀的 jQuery Javascript 函式庫,Churro 將會偵測到 Ajax 請求並自動返回JSON。Churro 在每個請求中定義了常數 ISAJAX。稍加規劃,就可以非常容易地創建動態應用程式,而這種方式完全可以在沒有使用 Javascript 的情況下進行。
學習 Churro
Churro 中有比本篇更多的功能。截至 2009 年 9 月 2 日,並沒有完整的正式文件可以用來編寫 Churro 代碼。請關注 Substance Labs 教學。
原文外掛簡介
Churro is a plugin that allows developers to easily create pages and functionality, in a style similar to CodeIgniter. By itself, Churro will not add any functionality to your WordPress site.
Tested with WordPress and WordPress MU 2.8.0 ~ 3.0.5
Requires PHP 5. PHP 4 is like 10 years old, you know?
Churro Basics
= URLs =
Churro requires friendly urls rather than query strings. Your url will usually be mapped as following: yoursite.com/class/method/variables
Controllers
The controller will be directly mapped to a file and class with the same name. For example,
yoursite.com/contact
will look for a file named contact.php in the /churro/ directory. This file should have a class contact that extends Churro. Without a defined method, it will default to index. All methods accessible through URLs will have ‘Action’ appended to it. The following code will provide scaffolding for yoursite.com/contact and yoursite.com/contact/submit
wpdb.
Views
Your views belong in your normal theme directory. If you are using multiple themes, you can override the direcotry using $this->Theme( 'directory-name' ) any place in the controller. To specify a view to use, $this->View( 'file-name' ). Seperating logic from views is the most important thing to remember in Churro. To set varaibles in your view, use $this->vars->var_name in the controller, and $var_name in your view.
Ajax / Javascript
If you use the excellent jQuery javascript library, Churro will detect ajax requests and automatically return JSON. Churro defines a constant ISAJAX on each request. With a little planning, it is very easy to create a dynamic application in a way that is totally accessible without javascript.
Learning Churro
There is much more functionality in Churro than outlined here. As of September 2, 2009, there is no complete, formal, documentation for writing code with Churro. Stay tuned to Substance Labs for tutorials.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Churro」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
延伸相關外掛(你可能也想知道)
WordPressIgniter 》這是一款將 CodeIgniter 整合至 WordPress 的外掛程式。, 為什麼需要 CodeIgniter/WordPress 整合的外掛程式?, , , 我(以及許多人)喜歡 CodeIgniter 的功...。
Author: Francis Crossen (fcrossen) 》Tina MVC 提供您基礎類別和助手類別與函式,可用於建立 WordPress 應用程式。, 它使用鬆散的模型檢視控制器模式,抽象化設計和邏輯,讓您和您的 HTML 設計師...。
Multi Vendor Campaign 》多供應商活動是一個必要的外掛,適用於流行的多供應商外掛,讓雄心勃勃的店主通過建立有限時活動,為特殊產品保留商店的頂級位置。願意支付額外佣金的供應商...。
Extensible Widgets 》itter account and display them in a view template., , 這個外掛提供了許多實用的小工具,對於開發人員和使用者來說都非常有用。它是採用 PHP 5 物件導向架...。
WPLib 》WPLib 是一款外掛,設計用於作為 Must-Use 外掛或嵌入主題中,以啟用開發複雜但強大且高效的 WordPress 應用程序和網站。, WPLib 是一個基礎庫,可以開發健壯...。