From 8da2e229362fc59329b3c3d8eea0dfcbf86759bb Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 3 Jan 2014 12:47:37 +0200 Subject: [ci skip] Update the Parser library docs --- user_guide_src/source/libraries/parser.rst | 49 +++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 14 deletions(-) (limited to 'user_guide_src/source/libraries/parser.rst') diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index 0b77ae4b9..5c184be58 100644 --- a/user_guide_src/source/libraries/parser.rst +++ b/user_guide_src/source/libraries/parser.rst @@ -46,15 +46,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: +Parsing templates +================= -$this->parser->parse() -====================== - -This method accepts a template name and data array as input, and it -generates a parsed version. Example:: - - $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 +72,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 +136,35 @@ 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 return the parsed template + :returns: mixed + + 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 return the parsed template + :returns: mixed + + 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 + :returns: void + + Sets the delimiters (opening and closing) for a value "tag" in a template. \ No newline at end of file -- cgit v1.2.3-24-g4f1b From cc042095bcce9856402cc04997f44310074716e0 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 3 Jan 2014 17:08:27 +0200 Subject: [ci skip] Some more generic user guide cleanup --- user_guide_src/source/libraries/parser.rst | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'user_guide_src/source/libraries/parser.rst') diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index 5c184be58..50bde82c7 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 + +
+ Initializing the Class ====================== -- cgit v1.2.3-24-g4f1b From 1e584208e420d1d864de2bc686d437ecdf0ce064 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Fri, 7 Feb 2014 21:50:36 +0200 Subject: [ci skip] Fix class reference sections of Image_lib, Parser and User agent docs --- user_guide_src/source/libraries/parser.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/libraries/parser.rst') diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index 50bde82c7..34ad65f2b 100644 --- a/user_guide_src/source/libraries/parser.rst +++ b/user_guide_src/source/libraries/parser.rst @@ -147,7 +147,7 @@ function:: Class Reference *************** -.. class: CI_Parser +.. class:: CI_Parser .. method:: parse($template, $data[, $return = FALSE]) -- cgit v1.2.3-24-g4f1b From 28c2c975b118016d07212ed8e7c22ff280309f82 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 8 Feb 2014 04:27:48 +0200 Subject: [ci skip] Add return types to library docs --- user_guide_src/source/libraries/parser.rst | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'user_guide_src/source/libraries/parser.rst') diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index 34ad65f2b..5af504a03 100644 --- a/user_guide_src/source/libraries/parser.rst +++ b/user_guide_src/source/libraries/parser.rst @@ -151,27 +151,29 @@ Class Reference .. method:: parse($template, $data[, $return = FALSE]) - :param string $template: Path to view file - :param array $data: Variable data - :param bool $return: Whether to return the parsed template - :returns: mixed + :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 return the parsed template - :returns: mixed + :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 - :returns: void + :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 -- cgit v1.2.3-24-g4f1b