亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

direktori cari
歡迎 目錄 快速參考圖 基本信息 服務(wù)器要求 許可協(xié)議 變更記錄 關(guān)于CodeIgniter 安裝 下載 CodeIgniter 安裝指導(dǎo) 從老版本升級(jí) 疑難解答 介紹 開(kāi)始 CodeIgniter 是什么? CodeIgniter 速記表 支持特性 應(yīng)用程序流程圖 模型-視圖-控制器 架構(gòu)目標(biāo) 教程 內(nèi)容提要 加載靜態(tài)內(nèi)容 創(chuàng)建新聞條目 讀取新聞條目 結(jié)束語(yǔ) 常規(guī)主題 CodeIgniter URL 控制器 保留字 視圖 模型 輔助函數(shù) 使用 CodeIgniter 類庫(kù) 創(chuàng)建你自己的類庫(kù) 使用 CodeIgniter 適配器 創(chuàng)建適配器 創(chuàng)建核心系統(tǒng)類 鉤子 - 擴(kuò)展框架的核心 自動(dòng)裝載資源 公共函數(shù) URI 路由 錯(cuò)誤處理 緩存 調(diào)試應(yīng)用程序 以CLI方式運(yùn)行 管理應(yīng)用程序 處理多環(huán)境 PHP替代語(yǔ)法 安全 開(kāi)發(fā)規(guī)范 類庫(kù)參考 基準(zhǔn)測(cè)試類 日歷類 購(gòu)物車類 配置類 Email 類 加密類 文件上傳類 表單驗(yàn)證詳解 FTP 類 圖像處理類 輸入類 Javascript 類 語(yǔ)言類 裝載類 遷移類 輸出類 分頁(yè)類 模板解析器類 安全類 Session 類 HTML 表格類 引用通告類 排版類 單元測(cè)試類 URI 類 User-Agent 類 表單驗(yàn)證 XML-RPC 和 XML-RPC 服務(wù)器 Zip 編碼類 緩存適配器 適配器參考 適配器 數(shù)據(jù)庫(kù)類 Active Record 類 數(shù)據(jù)庫(kù)緩存類 自定義函數(shù)調(diào)用 數(shù)據(jù)庫(kù)配置 連接你的數(shù)據(jù)庫(kù) 數(shù)據(jù)庫(kù)快速入門(mén)例子代碼 字段數(shù)據(jù) 數(shù)據(jù)庫(kù)維護(hù)類 查詢輔助函數(shù) 數(shù)據(jù)庫(kù)類 查詢 生成查詢記錄集 表數(shù)據(jù) 事務(wù) 數(shù)據(jù)庫(kù)工具類 JavaScript類 輔助函數(shù)參考 數(shù)組輔助函數(shù) CAPTCHA 輔助函數(shù) Cookie Helper 日期輔助函數(shù) 目錄輔助函數(shù) 下載輔助函數(shù) Email 輔助函數(shù) 文件輔助函數(shù) 表單輔助函數(shù) HTML輔助函數(shù) Inflector 輔助函數(shù) 語(yǔ)言輔助函數(shù) 數(shù)字輔助函數(shù) 路徑輔助函數(shù) 安全輔助函數(shù) 表情輔助函數(shù) 字符串輔助函數(shù) 文本輔助函數(shù) 排版輔助函數(shù) URL 輔助函數(shù) XML 輔助函數(shù)
watak

CodeIgniter 用戶指南 版本 2.1.0

編輯文檔、查看近期更改請(qǐng) 登錄 或 注冊(cè)  找回密碼
查看原文

排版類

排版類提供幫助你格式化文本的函數(shù)。

初始化排版類

和CI中的其他類一樣, 排版類也需要在控制器中這樣用 $this->load->library 方法初始化:

$this->load->library('typography');

一旦被加載, 排版類的對(duì)象就可以這樣使用: $this->typography

auto_typography()

格式化文本以便糾正語(yǔ)義和印刷的錯(cuò)誤HTML代碼。輸入一個(gè)字符串輸出如下的格式化文本:

  • 用一對(duì)P標(biāo)簽包住段落(看起來(lái)像是用兩個(gè)換行符把段落分隔開(kāi)似的)。
  • 除了出現(xiàn) <pre> 標(biāo)簽外,所有的單個(gè)換行符被轉(zhuǎn)換為 <br />。
  • 塊級(jí)別的元素,如<div>標(biāo)簽,沒(méi)有被段落包裝,但是如果他們包含段落的話就會(huì)包含文本。
  • 除了出現(xiàn)在標(biāo)簽中的引號(hào)外,引號(hào)會(huì)被轉(zhuǎn)換成正確的實(shí)體。
  • 撇號(hào)“'”被轉(zhuǎn)換為相應(yīng)的實(shí)體。
  • 雙破折號(hào) (像 -- 或--) 被轉(zhuǎn)換成 em—破折號(hào).
  • 三個(gè)連續(xù)的點(diǎn)也會(huì)被轉(zhuǎn)換為省略號(hào)…
  • 句子后連續(xù)的多個(gè)空格將被轉(zhuǎn)換為&nbsp;以便在網(wǎng)頁(yè)中顯示。

例如:

$string = $this->typography->auto_typography($string);

參數(shù)

有一個(gè)可選參數(shù):布爾值 TRUEFALSE決定是否對(duì)超過(guò)兩個(gè)的換行進(jìn)行壓縮,減少到兩行。

默認(rèn)不壓縮. 也就是說(shuō), 如果這個(gè)參數(shù)不設(shè)置, 它將如下工作:

$string = $this->typography->auto_typography($string, FALSE);

提示: 排版格式化可以處理密集數(shù)據(jù), 特別是你有很多內(nèi)容需要格式化處理。如果你選擇這個(gè)函數(shù)處理,你可以考慮緩存你的網(wǎng)頁(yè)。

format_characters()

This function is similar to the auto_typography function above, except that it only does character conversion:

試翻譯:此函數(shù)與上面出現(xiàn)的auto_typography函數(shù)類似, 唯一不同的是此函數(shù)僅對(duì)以下字符進(jìn)行轉(zhuǎn)換:

  • Quotes are converted to correctly facing curly quote entities, except those that appear within tags.
  • 試翻譯:除了在標(biāo)簽中的引號(hào)外,其他引號(hào)將被轉(zhuǎn)換成字符實(shí)體.
  • Apostrophes are converted to curly apostrophe entities.
  • 試翻譯:省略號(hào)將被轉(zhuǎn)換成正確的格式.
  • Double dashes (either like -- this or like--this) are converted to em—dashes.
  • 試翻譯:雙破折號(hào)(比如 -- 或--) 將被轉(zhuǎn)換成 em—符號(hào).
  • Three consecutive periods either preceding or following a word are converted to ellipsis…
  • 試翻譯:任何位置(詞前或詞后)的三個(gè)連續(xù)點(diǎn)號(hào)將被轉(zhuǎn)換成省略號(hào)…
  • Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.
  • 試翻譯:句末的雙空格將被轉(zhuǎn)換成看似雙空格的一個(gè)整體符號(hào).

Usage example:

試翻譯: 例子:

$string = $this->typography->format_characters($string);

nl2br_except_pre()

Converts newlines to <br /> tags unless they appear within <pre> tags. This function is identical to the native PHP nl2br() function, except that it ignores <pre> tags.

試翻譯: 除了 <pre> 標(biāo)簽內(nèi)的新行,將被轉(zhuǎn)換為 <br /> 標(biāo)簽. 除了本函(方法)數(shù)支持 <pre> 標(biāo)簽外, 其與PHP內(nèi)置函數(shù) nl2br() 相同.

Usage example:

試翻譯:例子:

$string = $this->typography->nl2br_except_pre($string);

protect_braced_quotes

When using the Typography library in conjunction with the Template Parser library it can often be desirable to protect single and double quotes within curly braces. To enable this, set the protect_braced_quotes class property to TRUE.

Usage example:

$this->load->library('typography');
$this->typography->protect_braced_quotes = TRUE;

?

翻譯貢獻(xiàn)者: Hex, icebird, neversaylate, noproblem, tonera, zhou78620051
最后修改: 2012-01-15 17:00:36
Artikel sebelumnya: Artikel seterusnya: