Dot notation with numeric indexes fix.

This commit is contained in:
jwronsky
2012-02-29 11:33:38 -08:00
committed by Justin Hileman
parent 19289f85e4
commit 6c2b85c36b
4 changed files with 8 additions and 5 deletions
+1 -1
View File
@@ -773,7 +773,7 @@ class Mustache {
$first = array_shift($chunks);
$ret = $this->_findVariableInContext($first, $this->_context);
while ($next = array_shift($chunks)) {
foreach ($chunks as $next) {
// Slice off a chunk of context for dot notation traversal.
$c = array($ret);
$ret = $this->_findVariableInContext($next, $c);
+3 -2
View File
@@ -9,10 +9,11 @@ class DotNotation extends Mustache {
public $person = array(
'name' => array('first' => 'Chris', 'last' => 'Firescythe'),
'age' => 24,
'hobbies' => array('Cycling', 'Fishing'),
'hometown' => array(
'city' => 'Cincinnati',
'city' => 'Cincinnati',
'state' => 'OH',
)
),
);
public $normal = 'Normal';
+2 -1
View File
@@ -1,4 +1,5 @@
* {{person.name.first}} {{person.name.last}}
* {{person.age}}
* {{person.hobbies.0}}, {{person.hobbies.1}}
* {{person.hometown.city}}, {{person.hometown.state}}
* {{normal}}
* {{normal}}
+2 -1
View File
@@ -1,4 +1,5 @@
* Chris Firescythe
* 24
* Cycling, Fishing
* Cincinnati, OH
* Normal
* Normal