Skip to content

Commit d69c76a

Browse files
committed
Updating to use new conventions in Cake 2.x
See http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html#view- no-longer-registered-in-classregistry
1 parent ad210dd commit d69c76a

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

MustacheHelper.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,16 @@ class MustacheHelper extends AppHelper {
4444
* @param array $values - passed in values that are merged with the view variables. Associative array
4545
* @return string - HTML from the Mustache template
4646
*/
47-
function element( $element, $values = array() ) {
47+
function render( $element, $values = array() ) {
4848
try {
4949
// get the template text. Also recursively loads all partials
5050
$template = $this->_loadTemplate( $element );
51-
52-
// grab the Cake view with all variables
53-
//$V = ClassRegistry::getObject('View');
54-
55-
//$this->log('classregistry keys');
56-
//$this->log(ClassRegistry::keys());
57-
51+
$this->log(am($this->_View->viewVars, $values));
52+
Debugger::getType($this->_View);
5853
// Instantiate Mustache, with all data passed in.
59-
$M = new Mustache( $template, $values, $this->partials );
54+
$M = new Mustache( $template, am($this->_View->viewVars, $values), $this->partials );
6055

61-
//generate the HTML
56+
// generate the HTML
6257
$result = $M->render();
6358

6459
} catch ( Exception $e ) {
@@ -105,7 +100,7 @@ function getSingleTemplate( $element ) {
105100
*/
106101
private function _getElementPath( $element ) {
107102
$element = str_replace('__', '/', $element);
108-
return ROOT . DS . 'app' . DS . 'View' . DS . 'Elements' . DS . $element . '.' . $this->ext;
103+
return ROOT . DS . 'app' . DS . 'View' . DS . 'Mustache' . DS . $element . '.' . $this->ext;
109104
}
110105

111106

0 commit comments

Comments
 (0)