Split Category box

Views: 907

Results 1 to 5 of 5
9 Jun 2011, 12:09 PM
#1
flopp avatar

flopp

New Zenner

Join Date:
Oct 2010
Posts:
6
Plugin Contributions:
0

Split Category box

Hi!

I try to split the category view into two separate boxes.
Lets say this is my Category Box:

  • Category 1
    • Subcat 1
    • Subcat 2
    • Subcat 3
  • Category 2
    • Subcat 1
    • Subcat 2
    • Subcat 3
  • Category 3
    • Subcat 1
    • Subcat 2
    • Subcat 3

I want a category box on top on the page with Category 1, 2, 3.
When users navigate to Category 1, the specific subcat's should appear in the left navigation box.

Could someone push me in the right direction? :)

9 Jun 2011, 12:59 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Split Category box

category box on top on the pageDo you mean horizontally at the base of the header, or in an actual box in the left or right column? The categories-tabs header navigation will show your top categories, and you can use Categories Dressing with its settings to not show top cats in the sidebox.

9 Jun 2011, 2:14 PM
#3
flopp avatar

flopp

New Zenner

Join Date:
Oct 2010
Posts:
6
Plugin Contributions:
0

Re: Split Category box

gjh42:

Do you mean horizontally at the base of the header, or in an actual box in the left or right column? The categories-tabs header navigation will show your top categories, and you can use Categories Dressing with its settings to not show top cats in the sidebox.

Yes, I have a navigation bar at the top.
The top-level categories should appear in a list below the navigation bar.

The sub-categories should be displayed in a category-sidebox on the left side.

I have tried the following in my /includes/templates/mytemplate/common/tpl_header.php:

(the remaining task is to hide the top-level categories from the category-sidebox)

<div class="main_categories" style="">
	<ul>
<?php 
	$main_category_tree = new category_tree;
    $check_categories = $db->Execute("select categories_id from " . TABLE_CATEGORIES . " where categories_status=1 and parent_id = 0 limit 1");
    if ($check_categories->RecordCount() > 0) {
      $box_categories_array = $main_category_tree->zen_category_tree();
    }
    //echo '<pre>';
    //print_r($box_categories_array);
    foreach($box_categories_array as $cat) {
    	if($cat['top'] == 'true') {
    		echo '<li><a href="'.zen_href_link(FILENAME_DEFAULT, $cat['path']).'"'.($cat['current'] ? ' class="active"' : '').'>'.$cat['name'].'</a></li>';
    	}
    }
?>
	</ul>
</div>
9 Jun 2011, 2:29 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Split Category box

I don't understand why you felt it necessary to reinvent the categories-tabs function when it is already in the stock header. If you wanted the top categories to look like a list, you could do it with CSS on cat-tabs elements.

Seeing your site would help us to advise you on what to do.

(the remaining task is to hide the top-level categories from the category-sidebox)Categories Dressing has a setting to do this. Alternatively, you could probably add to your stylesheet

#categories .category-top {display: none;}

9 Jun 2011, 2:58 PM
#5
flopp avatar

flopp

New Zenner

Join Date:
Oct 2010
Posts:
6
Plugin Contributions:
0

Re: Split Category box

gjh42:

I don't understand why you felt it necessary to reinvent the categories-tabs function when it is already in the stock header. If you wanted the top categories to look like a list, you could do it with CSS on cat-tabs elements.

Seeing your site would help us to advise you on what to do.
Categories Dressing has a setting to do this. Alternatively, you could probably add to your stylesheet

#categories .category-top {display: none;}

I see it is a bit rubbish... But I couldn't find the right way to do it from the start. I've got it to work now, thanks for your help!