summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/libraries/parser.rst
diff options
context:
space:
mode:
authorAndrew <browner12@gmail.com>2014-02-11 09:55:48 +0100
committerAndrew <browner12@gmail.com>2014-02-11 09:55:48 +0100
commitb6d8b962e44202a74c9b9321a4a53f61a753fccf (patch)
tree2d3c533a55964a0d124f7cd6bb1d3d98c7b84056 /user_guide_src/source/libraries/parser.rst
parent41713aaa665189dd0a191c333c73c4a7b9f37c78 (diff)
parent29e12641a1bb952f493462db6757ae12c7da1f2c (diff)
Merge branch 'develop' into patch-1
Conflicts: system/libraries/Calendar.php
Diffstat (limited to 'user_guide_src/source/libraries/parser.rst')
-rw-r--r--user_guide_src/source/libraries/parser.rst58
1 files changed, 44 insertions, 14 deletions
diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst
index 0b77ae4b9..5af504a03 100644
--- a/user_guide_src/source/libraries/parser.rst
+++ b/user_guide_src/source/libraries/parser.rst
@@ -35,6 +35,13 @@ representations that allow you to eliminate PHP from your templates
template parsing solution. We've kept it very lean on purpose in order
to maintain maximum performance.
+.. contents::
+ :local:
+
+.. raw:: html
+
+ <div class="custom-index container"></div>
+
Initializing the Class
======================
@@ -46,15 +53,10 @@ in your controller using the $this->load->library function::
Once loaded, the Parser library object will be available using:
$this->parser
-The following functions are available in this library:
-
-$this->parser->parse()
-======================
-
-This method accepts a template name and data array as input, and it
-generates a parsed version. Example::
+Parsing templates
+=================
- $this->load->library('parser');
+You can use the ``parse()`` method to parse (or render) simple templates, like this::
$data = array(
'blog_title' => 'My Blog Title',
@@ -77,12 +79,6 @@ third parameter::
$string = $this->parser->parse('blog_template', $data, TRUE);
-$this->parser->parse_string()
-==============================
-
-This method works exactly like parse(), only accepts a string as the
-first parameter in place of a view file.
-
Variable Pairs
==============
@@ -147,3 +143,37 @@ function::
$this->parser->parse('blog_template', $data);
+***************
+Class Reference
+***************
+
+.. class:: CI_Parser
+
+ .. method:: parse($template, $data[, $return = FALSE])
+
+ :param string $template: Path to view file
+ :param array $data: Variable data
+ :param bool $return: Whether to only return the parsed template
+ :returns: Parsed template string
+ :rtype: string
+
+ Parses a template from the provided path and variables.
+
+ .. method:: parse_string($template, $data[, $return = FALSE])
+
+ :param string $template: Path to view file
+ :param array $data: Variable data
+ :param bool $return: Whether to only return the parsed template
+ :returns: Parsed template string
+ :rtype: string
+
+ This method works exactly like ``parse()``, only it accepts the template as a
+ string instead of loading a view file.
+
+ .. method:: set_delimiters([$l = '{'[, $r = '}']])
+
+ :param string $l: Left delimiter
+ :param string $r: Right delimiter
+ :rtype: void
+
+ Sets the delimiters (opening and closing) for a value "tag" in a template. \ No newline at end of file