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:
My code below wraps a div around each item, I would like one div only containing the items instead. Can anyone please help?
// get max key
$key = count($data['_searchResultContainer']);
// loop through array, looking for category
for ($i = 0; $i <= $key; $i++) {
if (($data['_searchResultContainer'][$i]['cssprefix'] = 'kbsearch')){
echo "<div class='wwww'>";
}else if (($data['_searchResultContainer'][$i]['cssprefix'] = 'differentcategory')){
echo "<div class='eeee'>";
}
echo $data['_searchResultContainer'][$i]['subject'];
echo $data['_searchResultContainer'][$i]['url'];
echo $data['_searchResultContainer'][$i]['contentstext'];
echo "</div>";