I am having difficulty iterating over an array of data. My Code is as follows:
$root = $_SERVER['DOCUMENT_ROOT'];
require $root.'/assets/js/mustache.php-2.13.0/src/Mustache/Autoloader.php';
include($root."/utilities.php");
Mustache_Autoloader::register();
$url = "http://development.somesite.com/pages/lookup/sql/getData.php?dir=A&process=20&d=O";
$r = json_decode(Insert($url));
$template = "{{{#r}}}<b>{{PropName}}</b></br>{{{/r}}}";
$m = new Mustache_Engine;
$html = $m->render($template, $r);
echo "html: ".$html."</br>";
var_dump($r);
The result I get is:
html:
array(317) { [0]=> object(stdClass)#2 (2) { ["PropNo"]=> string(3) "409" ["PropName"]=> string(21) "WRD Avenue LLC" } [1]=> object(stdClass)#3 (2) { ["PropNo"]=> string(3) "410" ["PropName"]=> string(21) "1111 Avenue AB" }...}
The array was created using json_decode. I'm sure the answer is simple but I am clearly missing something here.
Thanks for your help.