Hello,
I have an array, and I would like to echo out each element depending up the value of one of the values, and put it a div for each category, not a div for each key, here is my code:
// get max key
$key = max($data['_searchResultContainer']);
// loop through array, looking for category
for ($i = 0; $i <= $key; $i++) {
if (($data['_searchResultContainer'][$i]['cssprefix'] = 'kbsearch')){
// if category is kbsearch then put it in a div
echo "<div>";
echo $data['_searchResultContainer'][$i]['subject'];
echo $data['_searchResultContainer'][$i]['url'];
echo $data['_searchResultContainer'][$i]['contentstext'];
echo "</div>";
}else if (($data['_searchResultContainer'][$i]['cssprefix'] = 'differentcategory')){
// if category is differentcategory then put it in a div
echo "<div>";
echo $data['_searchResultContainer'][$i]['subject'];
echo $data['_searchResultContainer'][$i]['url'];
echo $data['_searchResultContainer'][$i]['contentstext'];
echo "</div>";
}
}