views:

16

answers:

0

I am building some accordions dynamically from some data that gets returned from the database,

What should happen is that the user clicks on a link for the Blog, the blog accordion appears with header blog and click on that triggers the accordion affect. This bit works fine, the problem comes then the category blog has more than one of content, if returns more than piece of content it creates a blog accordion with another accordion in side of it ad this accordion holds the content, this is not correct I dont really know what I doing wrong either below is my code,

if(isset($returnedContent)) {
// the foreach loop below allows us to loop through the returnedContent and create the
// accordion headers, that the javascript is looking for.
$content = $returnedContent;
foreach ($content as $k => $v) {
    echo "<h2 class='header ".$v['categoryTitle']."'><a href='#'>{$v['categoryTitle']}</a></h2>";
    echo "<div class='".$v['categoryTitle']."'>";
}
// we need to do some butchering of the lead images, basically we need append .png on the aswell
// as _thumb, this is done by stripping away all reference to . png gif jpg from the image path
// that the data returns.
$replaceData = array(".", "png", "gif", "jpg", "jpeg");
// no we need to loop throught the content and return as link thumbnail images in the
// accordion menus.
//$returnedContent = $content;
//$content = $returnedContent;
foreach($returnedContent as $k => $v) {
    $imageName = str_replace($replaceData, "", $v['contentImageName']);
    echo "<a class='contentLink' href='".base_url()."welcome/getFullContent/$v[contentId]'>";
    echo "<img class='contentThumb' src='/media/uploads/contentImages/".$v['contentId']."/".$imageName."_thumb.png' alt='$v[contentTitle]' />";
    echo "</a>";
}
for($i = 0; $i < 12 - count($returnedContent); $i++) {
    echo "<div class='holderBox'>";
    echo "</div>";
}
echo "<div id='contentAbstract'>";
$this->load->view('content/buildabstract');
echo "</div>";
echo "</div>";

}

What exactly am i doing wrong?