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

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

CodeIgniter 用戶指南 版本 2.1.0

編輯文檔、查看近期更改請 登錄 或 注冊  找回密碼
查看原文

HTML輔助函數(shù)

HTML 輔助函數(shù)涵蓋了一些用于 HTML 操作的函數(shù)。

  • br()
  • heading()
  • img()
  • link_tag()
  • nbs()
  • ol() 和 ul()
  • meta()
  • doctype()

裝載輔助函數(shù)

本輔助函數(shù)的裝載通過如下代碼完成:

$this->load->helper('html');

可用的函數(shù)如下:

br()

生成指定個數(shù)的換行標(biāo)簽 (<br />) 。例如:

echo br(3);

如上代碼將顯示: <br /><br /><br />

heading()

幫助你創(chuàng)建 HTML <h1> 標(biāo)簽. 第一個字段用于標(biāo)記顯示內(nèi)容,第二個字段用于標(biāo)該標(biāo)簽所用字號。例如:

echo heading('Welcome!', 3);

如上代碼將顯示: <h3>Welcome!</h3>

Additionally, in order to add attributes to the heading tag such as HTML classes, ids or inline styles, a third parameter is available.

echo heading('Welcome!', 3, 'class="pink"')

The above code produces: <h3 class="pink">Welcome!<h3>

img()

幫助你創(chuàng)建 HTML <img /> 標(biāo)簽。 第1個參數(shù)包含的是圖片文件的路徑。 例如:

echo img('images/picture.jpg');
// 生成 <img src="http://site.com/images/picture.jpg" />

第2個參數(shù)是可選的, 其值為TRUE或者FALSE, 作用是決定該函數(shù)生成的圖片地址中是否包含由$config['index_page']所設(shè)置的起始頁面。 一般來說, 當(dāng)你使用媒體控制器時才使用這個。

echo img('images/picture.jpg', TRUE);
// 生成 <img src="http://site.com/index.php/images/picture.jpg" alt="" />

此外, 關(guān)聯(lián)數(shù)組也能夠被作為參數(shù)傳遞到 img() 函數(shù)中, 用來實現(xiàn)對所有屬性和值的完全控制。如果沒指定 alt 屬性,則 CodeIgniter 將產(chǎn)生一個空字符串。

$image_properties = array(
??????????'src' => 'images/picture.jpg',
??????????'alt' => 'Me, demonstrating how to eat 4 slices of pizza at one time',
??????????'class' => 'post_images',
??????????'width' => '200',
??????????'height' => '200',
??????????'title' => 'That was quite a night',
??????????'rel' => 'lightbox',
);

echo img($image_properties);
// <img src="http://site.com/index.php/images/picture.jpg" alt="Me, demonstrating how to eat 4 slices of pizza at one time" class="post_images" width="200" height="200" title="That was quite a night" rel="lightbox" />

link_tag()

幫助你創(chuàng)建 HTML <link /> 標(biāo)簽。在鏈接樣式表以及其他內(nèi)容時非常有用。參數(shù)包括 href 以及可選的 rel, type, title, media 以及 index_page。index_page 是一個TRUE/FALSE 值,作用是決定該函數(shù)生成的 href 地址中是否包含由 $config['index_page']所設(shè)置的起始頁面。 echo link_tag('css/mystyles.css');
// 生成 <link rel="stylesheet" type="text/css" />

更多示例:

echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');
// <link rel="shortcut icon" type="image/ico" />

echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');
// <link rel="alternate" type="application/rss+xml" title="My RSS Feed" />

此外,關(guān)聯(lián)數(shù)組也能夠被作為參數(shù)傳遞到 link_tag() 函數(shù)中, 用來實現(xiàn)對所有屬性和值的完全控制。

$link = array(
??????????'href' => 'css/printer.css',
??????????'rel' => 'stylesheet',
??????????'type' => 'text/css',
??????????'media' => 'print'
);

echo link_tag($link);
// <link rel="stylesheet" type="text/css" media="print" />

nbs()

生成不換行的指定個數(shù)的空格標(biāo)簽(&nbsp;)。例如:

echo nbs(3);

如上代碼將顯示: &nbsp;&nbsp;&nbsp;

ol()? 和? ul()

允許你通過簡單或多維的數(shù)組生成有序或無序的HTML列表。例如:

$this->load->helper('html');

$list = array(
????????????'red',
????????????'blue',
????????????'green',
????????????'yellow'
????????????);

$attributes = array(
????????????????????'class' => 'boldlist',
????????????????????'id'????=> 'mylist'
????????????????????);

echo ul($list, $attributes);

如上代碼將顯示:

<ul?class="boldlist"?id="mylist">
??<li>red</li>
??<li>blue</li>
??<li>green</li>
??<li>yellow</li>
</ul>

這是一個更復(fù)雜的例子,應(yīng)用了多維數(shù)組:

$this->load->helper('html');

$attributes = array(
????????????????????'class' => 'boldlist',
????????????????????'id'????=> 'mylist'
????????????????????);

$list = array(
????????????'colors' => array(
????????????????????????????????'red',
????????????????????????????????'blue',
????????????????????????????????'green'
????????????????????????????),
????????????'shapes' => array(
????????????????????????????????'round',
????????????????????????????????'square',
????????????????????????????????'circles' => array(
????????????????????????????????????????????????????'ellipse',
????????????????????????????????????????????????????'oval',
????????????????????????????????????????????????????'sphere'
????????????????????????????????????????????????????)
????????????????????????????),
????????????'moods'????=> array(
????????????????????????????????'happy',
????????????????????????????????'upset' => array(
????????????????????????????????????????????????????'defeated' => array(
????????????????????????????????????????????????????????????????????????'dejected',
????????????????????????????????????????????????????????????????????????'disheartened',
????????????????????????????????????????????????????????????????????????'depressed'
????????????????????????????????????????????????????????????????????????),
????????????????????????????????????????????????????'annoyed',
????????????????????????????????????????????????????'cross',
????????????????????????????????????????????????????'angry'
????????????????????????????????????????????????)
????????????????????????????)
????????????);


echo ul($list, $attributes);

如上代碼將顯示:

<ul?class="boldlist"?id="mylist">
??<li>colors
????<ul>
??????<li>red</li>
??????<li>blue</li>
??????<li>green</li>
????</ul>
??</li>
??<li>shapes
????<ul>
??????<li>round</li>
??????<li>suare</li>
??????<li>circles
????????<ul>
??????????<li>elipse</li>
??????????<li>oval</li>
??????????<li>sphere</li>
????????</ul>
??????</li>
????</ul>
??</li>
??<li>moods
????<ul>
??????<li>happy</li>
??????<li>upset
????????<ul>
??????????<li>defeated
????????????<ul>
??????????????<li>dejected</li>
??????????????<li>disheartened</li>
??????????????<li>depressed</li>
????????????</ul>
??????????</li>
??????????<li>annoyed</li>
??????????<li>cross</li>
??????????<li>angry</li>
????????</ul>
??????</li>
????</ul>
??</li>
</ul>

meta()

幫助你創(chuàng)建meta標(biāo)簽. 你可以將字符串、簡單數(shù)組或者多維數(shù)組傳遞給函數(shù). 例如:

echo meta('description', 'My Great site');
// 生成: <meta name="description" content="My Great Site" />


echo meta('Content-type', 'text/html; charset=utf-8', 'equiv'); // 注意第3個參數(shù).,可以是 "equiv" 或者 "name"
// 生成: <meta http-equiv="Content-type" content="text/html; charset=utf-8" />


echo meta(array('name' => 'robots', 'content' => 'no-cache'));
// 生成: <meta name="robots" content="no-cache" />


$meta = array(
????????array('name' => 'robots', 'content' => 'no-cache'),
????????array('name' => 'description', 'content' => 'My Great Site'),
????????array('name' => 'keywords', 'content' => 'love, passion, intrigue, deception'),
????????array('name' => 'robots', 'content' => 'no-cache'),
????????array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')
????);

echo meta($meta);
// 生成:
// <meta name="robots" content="no-cache" />
// <meta name="description" content="My Great Site" />
// <meta name="keywords" content="love, passion, intrigue, deception" />
// <meta name="robots" content="no-cache" />
// <meta http-equiv="Content-type" content="text/html; charset=utf-8" />

doctype()

幫助你創(chuàng)建文檔類型聲明以及DTD。默認(rèn)值是 XHTML 1.0 Strict ,但你也可以指定其他很多文檔類型。

echo doctype();
// <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

echo doctype('html4-trans');
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

下面是支持的文檔類型列表。它們都是可靈活配置的,可以在 application/config/doctypes.php 中配置。

文檔類型 選項 結(jié)果
XHTML 1.1 doctype('xhtml11') <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
XHTML 1.0 Strict doctype('xhtml1-strict') <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
XHTML 1.0 Transitional doctype('xhtml1-trans') <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
XHTML 1.0 Frameset doctype('xhtml1-frame') <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
HTML 5 doctype('html5') <!DOCTYPE html>
HTML 4 Strict doctype('html4-strict') <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
HTML 4 Transitional doctype('html4-trans') <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
HTML 4 Frameset doctype('html4-frame') <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

?

翻譯貢獻者: Hex, szlinz, yinzhili
最后修改: 2012-02-05 23:58:58
Article précédent: Article suivant: