From 307663f2c05f5800c4e17fe8eff9b329bbcb8fa8 Mon Sep 17 00:00:00 2001 From: James L Parry Date: Mon, 24 Nov 2014 10:59:09 -0800 Subject: Fixed the convention violations. Changed the section/subsection treatment Verified sphinx build. Signed-off-by:James L Parry --- user_guide_src/source/libraries/parser.rst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'user_guide_src/source') diff --git a/user_guide_src/source/libraries/parser.rst b/user_guide_src/source/libraries/parser.rst index 7c690ac2a..e7c7e3abd 100644 --- a/user_guide_src/source/libraries/parser.rst +++ b/user_guide_src/source/libraries/parser.rst @@ -45,9 +45,12 @@ representations that allow you to eliminate PHP from your templates
-********************** +******************************* +Using the Template Parser Class +******************************* + Initializing the Class -********************** +====================== Like most other classes in CodeIgniter, the Parser class is initialized in your controller using the $this->load->library function:: @@ -57,9 +60,8 @@ in your controller using the $this->load->library function:: Once loaded, the Parser library object will be available using: $this->parser -***************** Parsing templates -***************** +================= You can use the ``parse()`` method to parse (or render) simple templates, like this:: @@ -85,9 +87,8 @@ third parameter:: $string = $this->parser->parse('blog_template', $data, TRUE); -************** Variable Pairs -************** +============== The above example code allows simple variables to be replaced. What if you would like an entire block of variables to be repeated, with each @@ -150,9 +151,8 @@ function:: $this->parser->parse('blog_template', $data); -*************************** -Template Parser Usage Notes -*************************** +Usage Notes +=========== If you include substitution parameters that are not referenced in your template, they are ignored:: @@ -218,9 +218,8 @@ may not be as expected:: Result: Hello, John Doe (Mr Mr ) -************** View Fragments -************** +============== You do not have to use variable pairs to get the effect of iteration in your views. It is possible to use a view fragment for what would be inside -- cgit v1.2.3-24-g4f1b