Author Topic: How to change sub-category display?  (Read 4644 times)

0 Members and 1 Guest are viewing this topic.

Offline BlackGoat

  • Pre-Newbie
  • Posts: 3
    • View Profile
How to change sub-category display?
« on: April 01, 2007, 08:41:08 PM »
SOLVED, READ BELOW

Hi,

I want to display my categories/sub-categories in a list rather then seperating with a "," so instead of:

MAIN CATEGORY
subcat1, subcat2, subcat3

I want:
MAIN CATEGORY
- subcat1
- subcat2
- subcat3

I looked through every possible template file but I couldn't find anything.

Anyone who can help me?  :)

How to change the way sub-categories are displayed on the mainpage:

Find in "functions.php":
Quote
      $sub_cat_list .= "<a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";

      if ($i != $config['num_subcats'] && $i < $config['num_subcats'] && $i < $num_subs) {

        $sub_cat_list .= ", ";


Replace/add:

The part before the <:
If you want a symbol before your subcategory put it there. In example if you would change it to:
$sub_cat_list .= "- <a href=\"".$sub_url."\" class=\"subcat\">".format_text($cat_cache[$subcat_id]['cat_name'], 2)."</a>";
It would display a "-" before your subcategories. You can put virtually anything there you want as long as it has a valid mark up.

The , part:
This part defines what is placed after your sub-category name, as you can see it is standard set to a ", " if you change this to:
$sub_cat_list .= "<br />";
It'll display all sub-categories on a new line.

If you'd use the two examples as described above your sub-categories would appear as:
MAIN CATEGORY
- subcat1
- subcat2
- subcat3

Instead of the regular:
MAIN CATEGORY
subcat1, subcat2, subcat3
« Last Edit: April 06, 2007, 10:35:39 AM by BlackGoat »