Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #78 fix #80

Closed
wants to merge 3 commits into from

2 participants

@mcharytoniuk

Fix and test for issue #78.

examples/dot_notation/DotNotation.php
@@ -9,10 +9,11 @@ class DotNotation extends Mustache {
public $person = array(
'name' => array('first' => 'Chris', 'last' => 'Firescythe'),
'age' => 24,
- 'hometown' => array(
- 'city' => 'Cincinnati',
- 'state' => 'OH',
- )
+ 'hobbies' => array('Cycling', 'Fishing'),
@bobthecow Owner

Somehow the white space got goofy here. Tabs vs. spaces maybe?

Indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@bobthecow bobthecow referenced this pull request
Closed

Array rendering #78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 17, 2012
  1. @mcharytoniuk
Commits on Feb 19, 2012
  1. @mcharytoniuk

    * whitespace fix

    mcharytoniuk authored
  2. @mcharytoniuk
This page is out of date. Refresh to see the latest.
View
3  Mustache.php
@@ -767,8 +767,9 @@ protected function _getVariable($tag_name) {
$first = array_shift($chunks);
$ret = $this->_findVariableInContext($first, $this->_context);
- while ($next = array_shift($chunks)) {
+ while (!empty($chunks)) {
// Slice off a chunk of context for dot notation traversal.
+ $next = array_shift($chunks);
$c = array($ret);
$ret = $this->_findVariableInContext($next, $c);
}
View
3  examples/dot_notation/DotNotation.php
@@ -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',
'state' => 'OH',
- )
+ ),
);
public $normal = 'Normal';
View
3  examples/dot_notation/dot_notation.mustache
@@ -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}}
View
3  examples/dot_notation/dot_notation.txt
@@ -1,4 +1,5 @@
* Chris Firescythe
* 24
+* Cycling, Fishing
* Cincinnati, OH
-* Normal
+* Normal
Something went wrong with that request. Please try again.