Permalink
Browse files

Merge pull request #29 from bubbafoley/master

Load views from theme locations
  • Loading branch information...
2 parents 6d9bcb9 + fe2144c commit 24184cf14c47cda843e3fcc160f925f13ee0dd7a Phil Sturgeon committed Feb 24, 2012
Showing with 29 additions and 0 deletions.
  1. +14 −0 libraries/Template.php
  2. +15 −0 user_guide/library.html
@@ -630,6 +630,20 @@ public function layout_exists($layout)
return file_exists(self::_find_view_folder().'layouts/' . $layout . self::_ext($layout));
}
+ /**
+ * load_view
+ * Load views from theme paths if they exist.
+ *
+ * @access public
+ * @param string $view
+ * @param mixed $data
+ * @return array
+ */
+ public function load_view($view, $data = array())
+ {
+ return $this->_find_view($view, (array)$data);
+ }
+
// find layout files, they could be mobile or web
private function _find_view_folder()
{
@@ -182,6 +182,21 @@
->build('welcome_message');</pre>
<br />
+ <a name="load_view"></a>
+ <h2>load_view()</h2>
+ <p>Load views from theme paths if they exist.</p>
+
+ <p><strong>Parameters</strong></p>
+ <ol>
+ <li><var>$view</var>- string REQUIRED - Name of the view to be loaded.</li>
+ <li><var>$data</var> - array/object OPTIONAL - assign some extra data for this view.</li>
+ </ol>
+
+ <p><strong>Return</strong></p>
+ <ul>
+ <li>string. The contents of the rendered view.</li>
+ </ul>
+
<a name="build"></a>
<h2>build()</h2>
<p>Build the entire HTML combining partials, layouts and views.</p>

0 comments on commit 24184cf

Please sign in to comment.