diff options
Diffstat (limited to 'user_guide/helpers')
-rw-r--r-- | user_guide/helpers/string_helper.html | 11 | ||||
-rw-r--r-- | user_guide/helpers/url_helper.html | 16 |
2 files changed, 26 insertions, 1 deletions
diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html index 169ee4ebb..7c1d30c59 100644 --- a/user_guide/helpers/string_helper.html +++ b/user_guide/helpers/string_helper.html @@ -90,6 +90,17 @@ String Helper <code>echo random_string('alnum', 16);</code> +<h2>increment_string()</h2> + +<p>Increments a string by appending a number to it or increasing the number. Useful for creating "copies" or a file or duplicating database content which has unique titles or slugs.</p> + +<p>Usage example:</p> + +<code>echo increment_string('file', '_'); // "file_1"<br/> +echo increment_string('file', '-', 2); // "file-2"<br/> +echo increment_string('file-4'); // "file-5"<br/></code> + + <h2>alternator()</h2> <p>Allows two or more items to be alternated between, when cycling through a loop. Example:</p> diff --git a/user_guide/helpers/url_helper.html b/user_guide/helpers/url_helper.html index d20f1b1e2..ac9d0a68e 100644 --- a/user_guide/helpers/url_helper.html +++ b/user_guide/helpers/url_helper.html @@ -70,7 +70,7 @@ URL Helper <h2>site_url()</h2> <p>Returns your site URL, as specified in your config file. The index.php file (or whatever you have set as your -site <dfn>index_page</dfn> in your config file) will be added to the URL, as will any URI segments you pass to the function.</p> +site <dfn>index_page</dfn> in your config file) will be added to the URL, as will any URI segments you pass to the function, and the <dfn>url_suffix</dfn> as set in your config file.</p> <p>You are encouraged to use this function any time you need to generate a local URL so that your pages become more portable in the event your URL changes.</p> @@ -93,6 +93,20 @@ echo site_url($segments);</code> <p>Returns your site base URL, as specified in your config file. Example:</p> <code>echo base_url();</code> +<p>This function returns the same thing as site_url, without the <dfn>index_page</dfn> or <dfn>url_suffix</dfn> being appended.</p> + +<p>Also like site_url, you can supply segments as a string or an array. Here is a string example:</p> + +<code>echo base_url("blog/post/123");</code> + +<p>The above example would return something like: http://example.com/blog/post/123</p> + +<p>This is useful because unlike site_url(), you can supply a string to a file, such as an image or stylesheet. For example:</p> + +<code>echo base_url("images/icons/edit.png");</code> + +<p>This would give you something like: http://example.com/images/icons/edit.png</p> + <h2>current_url()</h2> <p>Returns the full URL (including segments) of the page being currently viewed.</p> |