Jump to content

pulling from database change color


sandbudd

Recommended Posts

Do you have error reporting turned on?

Also, you are still missing your closing curly brace on your foreach loop...add one more just below:

$page['content'] .= "<li><a href=\"subcategory.php?sCatID=$subcatID\">$bold_value</a></li>\n";

here is what works

 

<?php
require_once('includes/init.php');

$page['products'] = $catalog->getCategories();
$category = $catalog->getCategoryInfo($core->pageVar('catID', siteCore::VARTYPE_INT));


$page['content'] = "<h2>".$category['CategoryName']."</h2>\n<div class=\"mainContent\">\n";
if(count($category['Subcats'])>0)
{
	$page['content'] .= "<ul>\n";
	foreach($category['Subcats'] as $subcatID => $subcatName){        
    $bold_value = in_array($subcatID, $bolded_ids) ? "<strong>$subcatName (TOP 20)</strong>" : $subcatName;
    $page['content'] .= "<li><a href=\"subcategory.php?sCatID=$subcatID\">$bold_value</a></li>\n";
}

    
}
$page['content'] .= "</ul>\n";
$page['content'] .= "</div>";

print_page();
?>

Its working now?  Great!  You really need to turn on error reporting.  It would have told you some of these errors...like the missing braces...Very hard to debug with no error reporting...

 

Of course, only enable error reporting during coding time, not for production

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.