Skip to content

Instantly share code, notes, and snippets.

@hailwood
Created January 18, 2016 01:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hailwood/354b58af77170d551ec4 to your computer and use it in GitHub Desktop.
Save hailwood/354b58af77170d551ec4 to your computer and use it in GitHub Desktop.
<?php
class Page {
public function Repeat1($times)
{
$list = new ArrayList();
$formatter = new NumberFormatter('en-NZ', NumberFormatter::SPELLOUT);
for ($i = 1; $i <= $times; $i++) {
$list->push(array('Num' => $i, 'Word' => ucwords(strtolower($formatter->format($i)))));
}
return $list;
}
public function Repeat2($times)
{
$list = new ArrayList();
$formatter = new NumberFormatter('en-NZ', NumberFormatter::SPELLOUT);
for ($i = 1; $i <= $times; $i++) {
$list->push(array('Num2' => $i, 'Word2' => ucwords(strtolower($formatter->format($i)))));
}
return $list;
}
}
<% loop $Repeat1(5) %>
<h2>Inside repeat one iteration {$Num}</h2>
<% loop $Up.Repeat2(5) %>
<h3>Inside repeat two iteration {$Num2}</h3>
<p>Direct: {$Num}</p>
<p>UP: {$Up.Num}</p>
<p><%-- UP.UP: {$Up.Up.Num} --%> (already at top of scope error)</p>
<p>TOP: {$Top.Num}</p>
<% end_loop %>
<hr>
<% end_loop %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment