PDA

View Full Version : calling category name fails


foxeye
02-22-2007, 09:07 AM
I'm testing a new custom made skin but am not a pro coder... All works fine except the echo function of the category name. Can't seem to find out why. This is what I did:

<div class="categoryname"><?php echo $thecategory['name']; ?></div>

Posted a ticket and told me to replace the $i variable with the desired category id. Using the '.$categoryname[$i].' format. But... still don't get it.

Anyone who can help me out? Thanks in advance.

Tobias
02-22-2007, 10:16 AM
With SD 2.4 you should use these globally available arrays:
$categorylink[$i]
$categoryname[$i]
Replace $i with your loop variable, which should also use "$categoryrows" - the number of available categories.

I'd highly suggest for an example the "Wave" skin from SD.com and look at the "categories.php" as an example.

foxeye
02-22-2007, 03:14 PM
Cheched out the Wave skin and that explained. Found out that I missed out on this line

$thecategory = $DB->query_first("SELECT name FROM " . TABLE_PREFIX . "categories WHERE categoryid = '$categoryid'");

thanks for reply

Tobias
02-22-2007, 03:46 PM
If you are using Subdreamer 2.4, you actually shouldn't need to traverse all the category names yourself as they are already stored in above mentioned arrays (sorted by categoryid).

Granted, depending on your task, you may need to do it explicitly still. :)