protected function _renderTemplate($template) {
		if ($section = $this->_findSection($template)) {
			list($before, $type, $tag_name, $content, $after) = $section;

			$rendered_before = $this->_renderTags($before);

			$rendered_content = '';
			$val = $this->_getVariable($tag_name);
			switch($type) {
				// inverted section
				case '^':
					if (empty($val)) {
						$rendered_content = $this->_renderTemplate($content);
					}
					break;

				// regular section
				case '#':
					// higher order sections
					if ($this->_varIsCallable($val)) {
						$rendered_content = $this->_renderTemplate(call_user_func($val, $content));
					} else if ($this->_varIsIterable($val)) {
						foreach ($val as $local_context) {
							$this->_pushContext($local_context);
							$rendered_content .= $this->_renderTemplate($content);
							$this->_popContext();
						}
					} else if ($val) {
						if (is_array($val) || is_object($val)) {
							$this->_pushContext($val);
							$rendered_content = $this->_renderTemplate($content);
							$this->_popContext();
						} else {
							$rendered_content = $this->_renderTemplate($content);
						}
					}
					break;
			}

			return $rendered_before . $rendered_content . $this->_renderTemplate($after);
		}

		return $this->_renderTags($template);
	}
protected function _renderTemplate($template) {
		if ($section = $this->_findSection($template)) {
			list($before, $type, $tag_name, $content, $after) = $section;

			$rendered_before = $this->_renderTags($before);

			$rendered_content = '';
			$val = $this->_getVariable($tag_name);
			switch($type) {
				// inverted section
				case '^':
					if (empty($val)) {
						$rendered_content = $this->_renderTemplate($content);
					}
					break;

				// regular section
				case '#':
					// higher order sections
					if ($this->_varIsCallable($val)) {
						$rendered_content = $this->_renderTemplate(call_user_func($val, $content));
					} else if ($this->_varIsIterable($val)) {
						foreach ($val as $local_context) {
							$this->_pushContext($local_context);
							$rendered_content .= $this->_renderTemplate($content);
							$this->_popContext();
						}
					} else if ($val) {
						if (is_array($val) || is_object($val)) {
							$this->_pushContext($val);
							$rendered_content = $this->_renderTemplate($content);
							$this->_popContext();
						} else {
							$rendered_content = $this->_renderTemplate($content);
						}
					}
					break;
			}

			return $rendered_before . $rendered_content . $this->_renderTemplate($after);
		}

		return $this->_renderTags($template);
	}
protected function _renderTemplate ( $ template ) { if ( $ section = $ this -> _findSection ( $ template ) ) { list ( $ before , $ type , $ tag_name , $ content , $ after ) = $ section ; $ rendered_before = $ this -> _renderTags ( $ before ) ; $ rendered_content = '' ; $ val = $ this -> _getVariable ( $ tag_name ) ; switch ( $ type ) { // inverted section case '^' : if ( empty ( $ val ) ) { $ rendered_content = $ this -> _renderTemplate ( $ content ) ; } break ; // regular section case '#' : // higher order sections if ( $ this -> _varIsCallable ( $ val ) ) { $ rendered_content = $ this -> _renderTemplate ( call_user_func ( $ val , $ content ) ) ; } else if ( $ this -> _varIsIterable ( $ val ) ) { foreach ( $ val as $ local_context ) { $ this -> _pushContext ( $ local_context ) ; $ rendered_content .= $ this -> _renderTemplate ( $ content ) ; $ this -> _popContext ( ) ; } } else if ( $ val ) { if ( is_array ( $ val ) || is_object ( $ val ) ) { $ this -> _pushContext ( $ val ) ; $ rendered_content = $ this -> _renderTemplate ( $ content ) ; $ this -> _popContext ( ) ; } else { $ rendered_content = $ this -> _renderTemplate ( $ content ) ; } } break ; } return $ rendered_before . $ rendered_content . $ this -> _renderTemplate ( $ after ) ; } return $ this -> _renderTags ( $ template ) ; }
Internal render function, used for recursive calls.

@access protected
@param string $template
@return string Rendered Mustache template.
Internal render function used for recursive calls .