blob: 19550059c85f89421e933f8ea0553d918e8774b6 [file] [log] [blame]
adminb0dd10f2006-08-25 17:25:49 +00001<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html>
3<head>
4
5<title>Code Igniter User Guide</title>
6
7<style type='text/css' media='all'>@import url('../userguide.css');</style>
8<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
9
admin17a890d2006-09-27 20:42:42 +000010<script type="text/javascript" src="../nav/nav.js"></script>
admin2296fc32006-09-27 21:07:02 +000011<script type="text/javascript" src="../nav/prototype.lite.js"></script>
admin17a890d2006-09-27 20:42:42 +000012<script type="text/javascript" src="../nav/moo.fx.js"></script>
adminb0dd10f2006-08-25 17:25:49 +000013<script type="text/javascript">
14window.onload = function() {
admine334c472006-10-21 19:44:22 +000015 myHeight = new fx.Height('nav', {duration: 400});
adminb0dd10f2006-08-25 17:25:49 +000016 myHeight.hide();
17}
18</script>
19
20<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
21<meta http-equiv='expires' content='-1' />
22<meta http-equiv= 'pragma' content='no-cache' />
23<meta name='robots' content='all' />
24<meta name='author' content='Rick Ellis' />
25<meta name='description' content='Code Igniter User Guide' />
26
27</head>
28<body>
29
30<!-- START NAVIGATION -->
31<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
32<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle.jpg" width="153" height="44" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
33<div id="masthead">
34<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
35<tr>
admin05186612006-10-28 03:28:01 +000036<td><h1>Code Igniter User Guide Version 1.5.0</h1></td>
adminc0d5d522006-10-30 19:40:35 +000037<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
adminb0dd10f2006-08-25 17:25:49 +000038</tr>
39</table>
40</div>
41<!-- END NAVIGATION -->
42
43
44<!-- START BREADCRUMB -->
45<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
46<tr>
47<td id="breadcrumb">
48<a href="http://www.codeigniter.com/">Code Igniter Home</a> &nbsp;&#8250;&nbsp;
49<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
50Typography Helper
51</td>
52<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="www.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>
53</tr>
54</table>
55<!-- END BREADCRUMB -->
56
57<br clear="all" />
58
59
60<!-- START CONTENT -->
61<div id="content">
62
63
64<h1>Typography Helper</h1>
65
66<p>The Typography Helper file contains functions that help your format text in semantically relevant ways.</p>
67
68
69<h2>Loading this Helper</h2>
70
71<p>This helper is loaded using the following code:</p>
72<code>$this->load->helper('typography');</code>
73
74<p>The following functions are available:</p>
75
76
77<h2>auto_typography()</h2>
78
admine334c472006-10-21 19:44:22 +000079<p>Formats text so that it is semantically and typographically correct HTML. Takes a string as input and returns it with
adminb0dd10f2006-08-25 17:25:49 +000080the following formatting:</p>
81
82<ul>
83<li>Surrounds paragraphs within &lt;p&gt;&lt;/p&gt; (looks for double line breaks to identify paragraphs).</li>
84<li>Single line breaks are converted to &lt;br /&gt;, except those that appear within &lt;pre&gt; tags.</li>
admine7e1dcd2006-10-21 18:04:01 +000085<li>Block level elements, like &lt;div&gt; tags, are not wrapped within paragraphs, but their contained text is if it contains paragraphs.</li>
adminb0dd10f2006-08-25 17:25:49 +000086<li>Quotes are converted to correctly facing curly quote entities, except those that appear within tags.</li>
87<li>Apostrophes are converted to curly apostrophy entities.</li>
88<li>Double dashes (either like -- this or like--this) are converted to em&#8212;dashes.</li>
89<li>Three consecutive periods either preceding or following a word are converted to ellipsis&#8230;</li>
90<li>Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.</li>
91</ul>
92
93<p>Usage example:</p>
94
95<code>$string = auto_typography($string);</code>
96
admine334c472006-10-21 19:44:22 +000097<p><strong>Note:</strong> Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted.
adminb0dd10f2006-08-25 17:25:49 +000098If you choose to use this function you may want to consider
99<a href="../general/caching.html">caching</a> your pages.</p>
100
101
102<h2>nl2br_except_pre()</h2>
103
admine334c472006-10-21 19:44:22 +0000104<p>Converts newlines to &lt;br /&gt; tags unless they appear within &lt;pre&gt; tags.
adminb0dd10f2006-08-25 17:25:49 +0000105This function is identical to the native PHP <dfn>nl2br()</dfn> function, except that it ignores &lt;pre&gt; tags.</p>
106
107<p>Usage example:</p>
108
109<code>$string = nl2br_except_pre($string);</code>
110
111
112
113</div>
114<!-- END CONTENT -->
115
116
117<div id="footer">
118<p>
119Previous Topic:&nbsp;&nbsp;<a href="text_helper.html">Text Helper</a>
120&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
121<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
122<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
123Next Topic:&nbsp;&nbsp;<a href="url_helper.html">URL Helper</a>
124<p>
125<p><a href="http://www.codeigniter.com">Code Igniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 &nbsp;&middot;&nbsp; <a href="http://www.pmachine.com">pMachine, Inc.</a></p>
126</div>
127
128</body>
129</html>