summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-09-21 19:22:21 +0200
committeradmin <devnull@localhost>2006-09-21 19:22:21 +0200
commit05633d7348b85147a46a7396c3bee1928335fa7a (patch)
tree768d109a5094a58c135b3a59bae79c9e7d8bc8d9
parenta4d35347327c1e9a464696d153ad6f2ec4510283 (diff)
-rw-r--r--system/libraries/Parser.php2
-rw-r--r--system/libraries/URI.php41
-rw-r--r--user_guide/general/changelog.html8
-rw-r--r--user_guide/general/plugins.html2
-rw-r--r--user_guide/libraries/uri.html42
5 files changed, 84 insertions, 11 deletions
diff --git a/system/libraries/Parser.php b/system/libraries/Parser.php
index 9f6a814ae..b07b64fdd 100644
--- a/system/libraries/Parser.php
+++ b/system/libraries/Parser.php
@@ -47,7 +47,7 @@ class CI_Parser {
$OUT =& _load_class('CI_Output');
$obj =& get_instance();
- $template = $obj->load->view($template, '', TRUE);
+ $template = $obj->load->view($template, $data, TRUE);
if ($template == '')
{
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index 11562eb29..e831d9526 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -107,6 +107,41 @@ class CI_URI {
*/
function uri_to_assoc($n = 3, $default = array())
{
+ return $this->_uri_to_assoc($n, $default, 'segment');
+ }
+ /**
+ * Identical to above only it uses the re-routed segment array
+ *
+ */
+ function ruri_to_assoc($n = 3, $default = array())
+ {
+ return $this->_uri_to_assoc($n, $default, 'rsegment');
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
+ * Generate a key value pair from the URI string or Re-routed URI string
+ *
+ * @access private
+ * @param integer the starting segment number
+ * @param array an array of default values
+ * @param string which array we should use
+ * @return array
+ */
+ function _uri_to_assoc($n = 3, $default = array(), $which = 'segment')
+ {
+ if ($which == 'segment')
+ {
+ $total_segments = 'total_segments';
+ $segment_array = 'segment_array';
+ }
+ else
+ {
+ $total_segments = 'total_rsegments';
+ $segment_array = 'rsegment_array';
+ }
+
if ( ! is_numeric($n))
{
return $default;
@@ -117,7 +152,7 @@ class CI_URI {
return $this->keyval[$n];
}
- if ($this->total_segments() < $n)
+ if ($this->$total_segments() < $n)
{
if (count($default) == 0)
{
@@ -132,7 +167,7 @@ class CI_URI {
return $retval;
}
- $segments = array_slice($this->segment_array(), ($n - 1));
+ $segments = array_slice($this->$segment_array(), ($n - 1));
$i = 0;
$lastval = '';
@@ -322,7 +357,7 @@ class CI_URI {
* @access public
* @return string
*/
- function uri_rstring()
+ function ruri_string()
{
return '/'.implode('/', $this->rsegment_array()).'/';
}
diff --git a/user_guide/general/changelog.html b/user_guide/general/changelog.html
index e84428b75..23d382fcb 100644
--- a/user_guide/general/changelog.html
+++ b/user_guide/general/changelog.html
@@ -67,6 +67,8 @@ Change Log
<p>Release Date: September 25, 2006</p>
<ul>
+<li>Added a new feature that passes URI segments directly to your function calls as parameters. See the <a href="controllers.html">Controllers</a> page for more info.</li>
+<li>Added several new functions in the <a href="../libraries/uri.html">URI Class</a> to let you retrieve and manipulate Re-routed URI segments. Previously, the URI class did not permit you to access any re-routed URI segments when you used the <a href="routing.html">URI Routing</a> feature. Now it does.</li>
<li>Updated plugins, helpers, and language classes to allow your "application" folder to contain its own plugins, helpers, and language folders. If your application folder contains any of these resources, when you load them CI will look first in your local application folder. If not found, it instead looks in the global folders.</li>
<li>Added <a href="../helpers/inflector_helper.html">Inflector helper</a>.</li>
<li>Added element() function in the <a href="../helpers/array_helper.html">array helper</a>.</li>
@@ -77,11 +79,11 @@ Change Log
<li>Added Oracle database driver (still undergoing testing so it might have some bugs).</li>
<li>Added the ability to combine pseudo-variables and php variables in the template parser class.</li>
<li>Removed the is_numeric test from the db->escape() function.</li>
-<li>Fixed a MySQLi bug that was causing error messages not to contain proper errror data.</li>
+<li>Fixed a MySQLi bug that was causing error messages not to contain proper error data.</li>
<li>Fixed a bug in the email class which was causing it to ignore explicitly set alternative headers.</li>
<li>Fixed a bug that was causing a PHP error when the Exceptions class was called within the _get_config() function.</li>
<li>Fixed an oversight in the cookie helper in which the config file cookie settings were not being honored.</li>
-<li>Fixed an oversigt in the upload class. An item mentioned in the 1.4 changelog was missing.</li>
+<li>Fixed an oversight in the upload class. An item mentioned in the 1.4 changelog was missing.</li>
<li>Added some code to allow email attachments to be reset when sending batches of email.</li>
<li>Deprecated the <dfn>application/scripts</dfn> folder. It will continue to work for legacy users, but it is recommended that you create your own
<a href="../general/libraries.html">libraries</a> or <a href="../general/models.html">models</a> instead.
@@ -91,8 +93,6 @@ Change Log
-
-
<h2>Version 1.4.0</h2>
<p>Release Date: September 17, 2006</p>
diff --git a/user_guide/general/plugins.html b/user_guide/general/plugins.html
index db531fc81..d41c92ac6 100644
--- a/user_guide/general/plugins.html
+++ b/user_guide/general/plugins.html
@@ -123,7 +123,7 @@ Previous Topic:&nbsp;&nbsp;<a href="helpers.html">Helpers</a>
&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
-Next Topic:&nbsp;&nbsp;<a href="scripts.html">Scripts</a>
+Next Topic:&nbsp;&nbsp;<a href="libraries.html">Using Libraries</a>
<p>
<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>
</div>
diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html
index e56bf256f..bc8f0800e 100644
--- a/user_guide/libraries/uri.html
+++ b/user_guide/libraries/uri.html
@@ -63,7 +63,8 @@ URI Class
<h1>URI Class</h1>
-<p>The URI Class provides functions that help you retrieve information from your URI strings.</p>
+<p>The URI Class provides functions that help you retrieve information from your URI strings. If you use URI routing, you can
+also retrieve information about the re-routed segments.</p>
<p class="important"><strong>Note:</strong> This class is initialized automatically by the system so there is no need to do it manually.</p>
@@ -101,10 +102,15 @@ else<br />
}<br />
</code>
+<h2>$this->uri->rsegment(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it lets you retrieve a specific segment from your
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
<h2>$this->uri->slash_segment(<var>n</var>)</h2>
-<p>This function is almost identical to the one above, except it adds a trailing and/or leading slash based on the second
+<p>This function is almost identical to <dfn>$this->uri->segment()</dfn>, except it adds a trailing and/or leading slash based on the second
parameter. If the parameter is not used, a trailing slash added. Examples:</p>
<code>$this->uri->slash_segment(<var>3</var>);<br />
@@ -120,6 +126,13 @@ $this->uri->slash_segment(<var>3</var>, 'both');</code>
</ol>
+<h2>$this->uri->slash_rsegment(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it lets you add slashes a specific segment from your
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
+
+
<h2>$this->uri->uri_to_assoc(<var>n</var>)</h2>
<p>This function lets you turn URI segments into and associative array of key/value pairs. Consider this URI:</p>
@@ -157,6 +170,13 @@ $array = $this->uri->uri_to_assoc(3, $default);</code>
<p>Lastly, if a corresponding value is not found for a given key (if there is an odd number of URI segments) the value will be set to FALSE (boolean).</p>
+<h2>$this->uri->ruri_to_assoc(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it creates an associative array using the
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
+
+
<h2>$this->uri->assoc_to_uri()</h2>
<p>Takes an associative array as input and generates a URI string from it. The array keys will be included in the string. Example:</p>
@@ -180,11 +200,24 @@ $str = $this->uri->assoc_to_str($array);<br />
<code>news/local/345</code>
+<h2>$this->uri->ruri_string(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it returns the
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
+
+
<h2>$this->uri->total_segments()</h2>
<p>Returns the total number of segments.</p>
+<h2>$this->uri->total_rsegments(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it returns the total number of segments in your
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
+
<h2>$this->uri->segment_array()</h2>
@@ -199,6 +232,11 @@ foreach ($segs as $segment)<br />
&nbsp;&nbsp;&nbsp;&nbsp;echo '&lt;br />';<br />
}</code>
+<h2>$this->uri->rsegment_array(<var>n</var>)</h2>
+
+<p>This function is identical to the previous one, except that it returns the array of segments in your
+re-routed URI in the event you are using Code Igniter's <a href="../general/routing.html">URI Routing</a> feature.
+
</div>