Complex example was a direct port of ruby/javascript complex example, resulting in some methods named with PHP reserved keywords. Fixing that oversight.
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
<h1>{{header}}</h1>
|
<h1>{{header}}</h1>
|
||||||
{{#list}}
|
{{#notEmpty}}
|
||||||
<ul>
|
<ul>
|
||||||
{{#item}}
|
{{#item}}
|
||||||
{{#current}}
|
{{#current}}
|
||||||
<li><strong>{{name}}</strong></li>
|
<li><strong>{{name}}</strong></li>
|
||||||
{{/current}}
|
{{/current}}
|
||||||
{{#link}}
|
{{#isLink}}
|
||||||
<li><a href="{{url}}">{{name}}</a></li>
|
<li><a href="{{url}}">{{name}}</a></li>
|
||||||
{{/link}}
|
{{/isLink}}
|
||||||
{{/item}}
|
{{/item}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/list}}
|
{{/notEmpty}}
|
||||||
{{#empty}}
|
{{#isEmpty}}
|
||||||
<p>The list is empty.</p>
|
<p>The list is empty.</p>
|
||||||
{{/empty}}
|
{{/isEmpty}}
|
||||||
@@ -9,16 +9,16 @@ class Complex extends Mustache {
|
|||||||
array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
|
array('name' => 'blue', 'current' => false, 'url' => '#Blue'),
|
||||||
);
|
);
|
||||||
|
|
||||||
public function link() {
|
public function isLink() {
|
||||||
// Exploit the fact that the current iteration item is at the top of the context stack.
|
// Exploit the fact that the current iteration item is at the top of the context stack.
|
||||||
return $this->getVariable($current) != true;
|
return $this->getVariable('current', $this->context) != true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function list() {
|
public function notEmpty() {
|
||||||
return !($this->empty());
|
return !($this->isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function empty() {
|
public function isEmpty() {
|
||||||
return count($this->item) === 0;
|
return count($this->item) === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
<li><strong>red</strong></li>
|
<li><strong>red</strong></li>
|
||||||
<li><a href="#Green">green</a></li>
|
<li><a href="#Green">green</a></li>
|
||||||
<li><a href="#Blue">blue</a></li>
|
<li><a href="#Blue">blue</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user