I am generating a list from sql server, filtering it based on new and old records and displaying them in their respective categories on the webpage. I want to show unique list bullets for old and new records. What Im currently getting is a mashup of every record from each category on top of eachother. The icons for the list items are coming from some twitter bootstrap css, using glyphicons. The new records also have a popover that displays on hover. The list-generating code
foreach($resultArray as $category_name => $items)
{
echo '<h3>'. $category_name.'</h3><ul>';
foreach($items as $itemid => $itemDetails)
{
?>
<li class="<?php if(strtotime($itemDetails['posted']) > (strtotime('-30 days'))){echo 'icon-star';} else {echo '';} ?>" data-content="This item is new on Corkboard. Check it out!" data-original-title="New Item">
<?php
echo '<a href="newGenView.php?id='.$itemid.'">'.$itemDetails['name'].' - '.$itemDetails['description'].'</a>';
?>
</li>
<?php
}//foreach
echo '</ul>';
}//foreach
?>
And, I have these script tags:
<script type="text/javascript" src="assets/js/bootstrap-popover.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$(this).popover(options);
});
</script>
Any ideas or other ways to do this solution?
data-contentattributes to the new<li>.<li>s and remove parameteroptions, if you don’t initialize it.<i>like in the bootstrap description.The final html could be:
Also see this example.