From 6084a37a3ce9e79386b099a34119d6d394dab3e0 Mon Sep 17 00:00:00 2001 From: Jeremy Bush Date: Mon, 5 Jul 2010 17:50:41 -0500 Subject: [PATCH] Adding examples for object sections --- .../Sections_Iterable_Object.php | 17 +++++++++++ .../sections.mustache | 6 ++++ .../sections_iterable_object/sections.txt | 4 +++ .../Sections_Noniterable_Object.php | 29 +++++++++++++++++++ .../sections.mustache | 6 ++++ .../sections_noniterable_object/sections.txt | 4 +++ 6 files changed, 66 insertions(+) create mode 100644 examples/sections_iterable_object/Sections_Iterable_Object.php create mode 100644 examples/sections_iterable_object/sections.mustache create mode 100644 examples/sections_iterable_object/sections.txt create mode 100644 examples/sections_noniterable_object/Sections_Noniterable_Object.php create mode 100644 examples/sections_noniterable_object/sections.mustache create mode 100644 examples/sections_noniterable_object/sections.txt diff --git a/examples/sections_iterable_object/Sections_Iterable_Object.php b/examples/sections_iterable_object/Sections_Iterable_Object.php new file mode 100644 index 0000000..ee2f661 --- /dev/null +++ b/examples/sections_iterable_object/Sections_Iterable_Object.php @@ -0,0 +1,17 @@ + 'And it worked the second time.', + 'bar' => 'As well as the third.' + ); + + public function __get($key) + { + return isset($this->_data[$key]) ? $this->_data[$key] : NULL; + } + + public function __isset($key) + { + return isset($this->_data[$key]); + } +} \ No newline at end of file diff --git a/examples/sections_noniterable_object/sections.mustache b/examples/sections_noniterable_object/sections.mustache new file mode 100644 index 0000000..9119608 --- /dev/null +++ b/examples/sections_noniterable_object/sections.mustache @@ -0,0 +1,6 @@ +* {{ start }} +{{# middle }} +* {{ foo }} +* {{ bar }} +{{/ middle }} +* {{ final }} \ No newline at end of file diff --git a/examples/sections_noniterable_object/sections.txt b/examples/sections_noniterable_object/sections.txt new file mode 100644 index 0000000..e6b2d7a --- /dev/null +++ b/examples/sections_noniterable_object/sections.txt @@ -0,0 +1,4 @@ +* It worked the first time. +* And it worked the second time. +* As well as the third. +* Then, surprisingly, it worked the final time. \ No newline at end of file