Skip to content

Commit 31e485a

Browse files
author
Phil Sturgeon
committed
Merge branch 'master' of git://github.com/philsturgeon/codeigniter-template
2 parents 8c5297f + 78525c1 commit 31e485a

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

libraries/Template.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,9 @@ public function build($view, $data = array(), $return = FALSE)
278278
public function title()
279279
{
280280
// If we have some segments passed
281-
if ($title_segments =& func_get_args())
281+
if (func_num_args() >= 1)
282282
{
283+
$title_segments = func_get_args();
283284
$this->_title = implode($this->_title_separator, $title_segments);
284285
}
285286

@@ -630,6 +631,20 @@ public function layout_exists($layout)
630631
return file_exists(self::_find_view_folder().'layouts/' . $layout . self::_ext($layout));
631632
}
632633

634+
/**
635+
* load_view
636+
* Load views from theme paths if they exist.
637+
*
638+
* @access public
639+
* @param string $view
640+
* @param mixed $data
641+
* @return array
642+
*/
643+
public function load_view($view, $data = array())
644+
{
645+
return $this->_find_view($view, (array)$data);
646+
}
647+
633648
// find layout files, they could be mobile or web
634649
private function _find_view_folder()
635650
{

user_guide/library.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,21 @@ <h2>inject_partial()</h2>
182182
->build('welcome_message');</pre>
183183
<br />
184184

185+
<a name="load_view"></a>
186+
<h2>load_view()</h2>
187+
<p>Load views from theme paths if they exist.</p>
188+
189+
<p><strong>Parameters</strong></p>
190+
<ol>
191+
<li><var>$view</var>- string REQUIRED - Name of the view to be loaded.</li>
192+
<li><var>$data</var> - array/object OPTIONAL - assign some extra data for this view.</li>
193+
</ol>
194+
195+
<p><strong>Return</strong></p>
196+
<ul>
197+
<li>string. The contents of the rendered view.</li>
198+
</ul>
199+
185200
<a name="build"></a>
186201
<h2>build()</h2>
187202
<p>Build the entire HTML combining partials, layouts and views.</p>

0 commit comments

Comments
 (0)