blob: a6920ee184b7b1499621952098ee690dd775d128 [file] [log] [blame]
Derek Allard2067d1a2008-11-13 22:59:24 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3<head>
4
5<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6<title>HTML Helper : CodeIgniter User Guide</title>
7
8<style type='text/css' media='all'>@import url('../userguide.css');</style>
9<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
10
11<script type="text/javascript" src="../nav/nav.js"></script>
12<script type="text/javascript" src="../nav/prototype.lite.js"></script>
13<script type="text/javascript" src="../nav/moo.fx.js"></script>
14<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
15
16<meta http-equiv='expires' content='-1' />
17<meta http-equiv= 'pragma' content='no-cache' />
18<meta name='robots' content='all' />
19<meta name='author' content='ExpressionEngine Dev Team' />
20<meta name='description' content='CodeIgniter User Guide' />
21
22</head>
23<body>
24
25<!-- START NAVIGATION -->
26<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
27<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
28<div id="masthead">
29<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
30<tr>
Derek Jonesbbedc762009-09-11 14:47:37 +000031<td><h1>CodeIgniter User Guide Version 1.7.2</h1></td>
Derek Allard2067d1a2008-11-13 22:59:24 +000032<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
33</tr>
34</table>
35</div>
36<!-- END NAVIGATION -->
37
38
39<!-- START BREADCRUMB -->
40<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
41<tr>
42<td id="breadcrumb">
43<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
44<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
45HTML Helper
46</td>
47<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
48</tr>
49</table>
50<!-- END BREADCRUMB -->
51
52<br clear="all" />
53
54
55<!-- START CONTENT -->
56<div id="content">
57
58
59<h1>HTML Helper</h1>
60
61<p>The HTML Helper file contains functions that assist in working with HTML.</p>
62
Derek Allard14149872009-07-22 11:52:09 +000063<ul>
64 <li><a href="#br">br()</a></li>
65 <li><a href="#heading">heading()</a></li>
66 <li><a href="#img">img()</a></li>
67 <li><a href="#link_tag">link_tag()</a></li>
68 <li><a href="#nbs">nbs()</a></li>
69 <li><a href="#ol_and_ul">ol() and ul()</a></li>
70 <li><a href="#meta">meta()</a></li>
71 <li><a href="#doctype">doctype()</a></li>
72</ul>
Derek Allard2067d1a2008-11-13 22:59:24 +000073
74<h2>Loading this Helper</h2>
75
76<p>This helper is loaded using the following code:</p>
77<code>$this->load->helper('html');</code>
78
79<p>The following functions are available:</p>
80
Derek Allard14149872009-07-22 11:52:09 +000081<h2><a name="br"></a>br()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +000082<p>Generates line break tags (&lt;br />) based on the number you submit. Example:</p>
83<code>echo br(3);</code>
84<p>The above would produce: &lt;br />&lt;br />&lt;br /></p>
85
Derek Allard14149872009-07-22 11:52:09 +000086<h2><a name="heading"></a>heading()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +000087<p>Lets you create HTML &lt;h1> tags. The first parameter will contain the data, the
88second the size of the heading. Example:</p>
89<code>echo heading('Welcome!', 3);</code>
90<p>The above would produce: &lt;h3>Welcome!&lt;/h3></p>
Derek Allard14149872009-07-22 11:52:09 +000091
92<h2><a name="img"></a>img()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +000093<p>Lets you create HTML &lt;img /&gt; tags. The first parameter contains the image source. Example:</p>
94<code>echo img('images/picture.jpg');<br />
95// gives &lt;img src=&quot;http://site.com/images/picture.jpg&quot; /&gt;</code>
96<p>There is an optional second parameter that is a TRUE/FALSE value that specifics if the src should have the page specified by $config['index_page'] added to the address it creates. Presumably, this would be if you were using a media controller.</p>
97<p><code>echo img('images/picture.jpg', TRUE);<br />
98// gives &lt;img src=&quot;http://site.com/index.php/images/picture.jpg&quot; /&gt;</code></p>
99<p>Additionally, an associative array can be passed to the img() function for complete control over all attributes and values.</p>
100<p><code> $image_properties = array(<br />
101 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'src' =&gt; 'images/picture.jpg',<br />
102 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'alt' =&gt; 'Me, demonstrating how to eat 4 slices of pizza at one time',<br />
103 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'class' =&gt; 'post_images',<br />
104 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'width' =&gt; '200',<br />
105 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'height' =&gt; '200',<br />
106 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' =&gt; 'That was quite a night',<br />
107 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'rel' =&gt; 'lightbox',<br />
108 );<br />
109 <br />
110 img($image_properties);<br />
111 // &lt;img src=&quot;http://site.com/index.php/images/picture.jpg&quot; alt=&quot;Me, demonstrating how to eat 4 slices of pizza at one time&quot; class=&quot;post_images&quot; width=&quot;200&quot; height=&quot;200&quot; title=&quot;That was quite a night&quot; rel=&quot;lightbox&quot; /&gt;</code></p>
Derek Allard14149872009-07-22 11:52:09 +0000112
113<h2><a name="link_tag"></a>link_tag()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +0000114<p>Lets you create HTML &lt;link /> tags. This is useful for stylesheet links, as well as other links. The parameters are href, with optional rel, type, title, media and index_page. index_page is a TRUE/FALSE value that specifics if the href should have the page specified by $config['index_page'] added to the address it creates.<code>
115echo link_tag('css/mystyles.css');<br />
116// gives &lt;link href=&quot;http://site.com/css/mystyles.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;</code></p>
117<p>Further examples:</p>
118
119<code>
120 echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');<br />
121 // &lt;link href=&quot;http://site.com/favicon.ico&quot; rel=&quot;shortcut icon&quot; type=&quot;image/ico&quot; /&gt;
122 <br />
123 <br />
Derek Allard7d3773a2009-02-04 13:11:56 +0000124 echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');<br />
Derek Allard2067d1a2008-11-13 22:59:24 +0000125 // &lt;link href=&quot;http://site.com/feed&quot; rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;My RSS Feed&quot; /&gt; </code>
126<p>Additionally, an associative array can be passed to the link() function for complete control over all attributes and values.</p>
127<p><code>
128 $link = array(<br />
129 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'href' =&gt; 'css/printer.css',<br />
130 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'rel' =&gt; 'stylesheet',<br />
131 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'type' =&gt; 'text/css',<br />
132 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'media' =&gt; 'print'<br />
133 );<br />
134 <br />
135 echo link_tag($link);<br />
136 // &lt;link href=&quot;http://site.com/css/printer.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;print&quot; /&gt;</code></p>
137
Derek Allard14149872009-07-22 11:52:09 +0000138<h2><a name="nbs"></a>nbs()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +0000139<p>Generates non-breaking spaces (&amp;nbsp;) based on the number you submit. Example:</p>
140<code>echo nbs(3);</code>
141<p>The above would produce: &amp;nbsp;&amp;nbsp;&amp;nbsp;</p>
142
Derek Allard14149872009-07-22 11:52:09 +0000143<h2><a name="ol_and_ul"></a>ol()&nbsp; and&nbsp; ul()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +0000144
145<p>Permits you to generate ordered or unordered HTML lists from simple or multi-dimensional arrays. Example:</p>
146
147<code>
148$this->load->helper('html');<br />
149<br />
150$list = array(<br />
151&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'red', <br />
152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'blue', <br />
153&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'green',<br />
154&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'yellow'<br />
155&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
156<br />
157$attributes = array(<br />
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'class' => 'boldlist',<br />
159&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'id'&nbsp;&nbsp;&nbsp;&nbsp;=> 'mylist'<br />
160&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
161<br />
162echo ul($list, $attributes);<br />
163</code>
164
165<p>The above code will produce this:</p>
166
167<code>
168&lt;ul&nbsp;class="boldlist"&nbsp;id="mylist"><br />
169&nbsp;&nbsp;&lt;li>red&lt;/li><br />
170&nbsp;&nbsp;&lt;li>blue&lt;/li><br />
171&nbsp;&nbsp;&lt;li>green&lt;/li><br />
172&nbsp;&nbsp;&lt;li>yellow&lt;/li><br />
173&lt;/ul>
174</code>
175
176<p>Here is a more complex example, using a multi-dimensional array:</p>
177
178<code>
179$this->load->helper('html');<br />
180<br />
Derek Allard904094a2009-02-10 14:00:34 +0000181$attributes = array(<br />
182&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'class' => 'boldlist',<br />
183&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'id'&nbsp;&nbsp;&nbsp;&nbsp;=> 'mylist'<br />
184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
215<br />
216<br />
Derek Allard904094a2009-02-10 14:00:34 +0000217echo ul($list, $attributes);</code>
Derek Allard2067d1a2008-11-13 22:59:24 +0000218
219<p>The above code will produce this:</p>
220
221<code>
222&lt;ul&nbsp;class="boldlist"&nbsp;id="mylist"&gt;<br />
223&nbsp;&nbsp;&lt;li&gt;colors<br />
224&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
225&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;red&lt;/li&gt;<br />
226&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;blue&lt;/li&gt;<br />
227&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;green&lt;/li&gt;<br />
228&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
229&nbsp;&nbsp;&lt;/li&gt;<br />
230&nbsp;&nbsp;&lt;li&gt;shapes<br />
231&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
232&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;round&lt;/li&gt;<br />
233&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;suare&lt;/li&gt;<br />
234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;circles<br />
235&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
236&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;elipse&lt;/li&gt;<br />
237&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;oval&lt;/li&gt;<br />
238&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;sphere&lt;/li&gt;<br />
239&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/li&gt;<br />
241&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
242&nbsp;&nbsp;&lt;/li&gt;<br />
243&nbsp;&nbsp;&lt;li&gt;moods<br />
244&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
245&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;happy&lt;/li&gt;<br />
246&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;upset<br />
247&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
248&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;defeated<br />
249&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
250&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;dejected&lt;/li&gt;<br />
251&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;disheartened&lt;/li&gt;<br />
252&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;depressed&lt;/li&gt;<br />
253&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
254&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/li&gt;<br />
255&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;annoyed&lt;/li&gt;<br />
256&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;cross&lt;/li&gt;<br />
257&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;li&gt;angry&lt;/li&gt;<br />
258&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
259&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/li&gt;<br />
260&nbsp;&nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
261&nbsp;&nbsp;&lt;/li&gt;<br />
262&lt;/ul&gt;
263</code>
264
265
266
Derek Allard14149872009-07-22 11:52:09 +0000267<h2><a name="meta"></a>meta()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +0000268
269<p>Helps you generate meta tags. You can pass strings to the function, or simple arrays, or multidimensional ones. Examples:</p>
270
271<code>
272echo meta('description', 'My Great site');<br />
273// Generates: &lt;meta name="description" content="My Great Site" /><br />
274<br /><br />
275
276echo meta('Content-type', 'text/html; charset=utf-8', 'equiv'); // Note the third parameter. Can be "equiv" or "name"<br />
277// Generates: &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /><br />
278
279<br /><br />
280
281echo meta(array('name' => 'robots', 'content' => 'no-cache'));<br />
282// Generates: &lt;meta name="robots" content="no-cache" /><br />
283
284<br /><br />
285
286$meta = array(<br />
287&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('name' => 'robots', 'content' => 'no-cache'),<br />
288&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('name' => 'description', 'content' => 'My Great Site'),<br />
289&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('name' => 'keywords', 'content' => 'love, passion, intrigue, deception'),<br />
290&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('name' => 'robots', 'content' => 'no-cache'),<br />
291&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')<br />
292&nbsp;&nbsp;&nbsp;&nbsp;);<br />
293<br />
294echo meta($meta);
295<br />
296// Generates: <br />
297// &lt;meta name="robots" content="no-cache" /><br />
298// &lt;meta name="description" content="My Great Site" /><br />
299// &lt;meta name="keywords" content="love, passion, intrigue, deception" /><br />
300// &lt;meta name="robots" content="no-cache" /><br />
301// &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" />
302</code>
303
304
Derek Allard14149872009-07-22 11:52:09 +0000305<h2><a name="doctype"></a>doctype()</h2>
Derek Allard2067d1a2008-11-13 22:59:24 +0000306
307<p>Helps you generate document type declarations, or DTD's. XHTML 1.0 Strict is used by default, but many doctypes are available.</p>
308
309<code>
Derek Allard8ab36a52009-04-14 19:23:10 +0000310echo doctype();<br />
Derek Allard2067d1a2008-11-13 22:59:24 +0000311// &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;<br />
312<br />
313echo doctype('html4-trans');<br />
314// &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
315</code>
316
317<p>The following is a list of doctype choices. These are configurable, and pulled from <samp>application/config/doctypes.php</samp></p>
318
319<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
320 <tr>
321 <th>Doctype</th>
322 <th>Option</th>
323 <th>Result</th>
324 </tr>
325 <tr>
326 <td class="td">XHTML 1.1</td>
327 <td class="td">doctype('xhtml11')</td>
328 <td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;</td>
329 </tr>
330 <tr>
331 <td class="td">XHTML 1.0 Strict</td>
332 <td class="td">doctype('xhtml1-strict')</td>
333 <td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</td>
334 </tr>
335 <tr>
336 <td class="td">XHTML 1.0 Transitional</td>
337 <td class="td">doctype('xhtml1-trans')</td>
338 <td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</td>
339 </tr>
340 <tr>
341 <td class="td">XHTML 1.0 Frameset</td>
342 <td class="td">doctype('xhtml1-frame')</td>
343 <td class="td">&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"&gt;</td>
344 </tr>
345 <tr>
346 <td class="td">HTML 5</td>
347 <td class="td">doctype('html5')</td>
348 <td class="td">&lt;!DOCTYPE html&gt;</td>
349 </tr>
350 <tr>
351 <td class="td">HTML 4 Strict</td>
352 <td class="td">doctype('html4-strict')</td>
353 <td class="td">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;</td>
354 </tr>
355 <tr>
356 <td class="td">HTML 4 Transitional</td>
357 <td class="td">doctype('html4-trans')</td>
358 <td class="td">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;</td>
359 </tr>
360 <tr>
361 <td class="td">HTML 4 Frameset</td>
362 <td class="td">doctype('html4-frame')</td>
363 <td class="td">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"&gt;</td>
364 </tr>
365</table>
366
367
368
369
370</div>
371<!-- END CONTENT -->
372
373
374<div id="footer">
375<p>
376Previous Topic:&nbsp;&nbsp;<a href="form_helper.html">Form Helper</a>
377&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
378<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
379<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
380Next Topic:&nbsp;&nbsp;<a href="path_helper.html"> Path Helper</a></p>
Derek Jones7f3719f2010-01-05 13:35:37 +0000381<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006-2010 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">Ellislab, Inc.</a></p>
Derek Allard2067d1a2008-11-13 22:59:24 +0000382</div>
383
384</body>
adminb0dd10f2006-08-25 17:25:49 +0000385</html>