I didn’t find any way to do this in the docs, so I came up with a SQL query.
If you go to a specific category, there is no way to display a bread crumb menu with all its parent categories. It’s only possible to do so in a weblog entry, not on the category listing pages. The following code makes it possible.
Also, the following code gives a listing of all the subcategories.
=======================================
{exp:weblog:category_heading}
<a href="####home">HOME</a>{exp:query sql="SELECT exp_categories.cat_id, exp_categories.parent_id, exp_categories_1.cat_name AS c1, exp_categories_2.cat_name AS c2, exp_categories_3.cat_name AS c3, exp_categories_4.cat_name AS c4, exp_categories_1.cat_id AS i1, exp_categories_2.cat_id AS i2, exp_categories_3.cat_id AS i3, exp_categories_4.cat_id AS i4
FROM (((exp_categories INNER JOIN exp_categories AS exp_categories_1 ON exp_categories.parent_id = exp_categories_1.cat_id) LEFT JOIN exp_categories AS exp_categories_2 ON exp_categories_1.parent_id = exp_categories_2.cat_id) LEFT JOIN exp_categories AS exp_categories_3 ON exp_categories_2.parent_id = exp_categories_3.cat_id) LEFT JOIN exp_categories AS exp_categories_4 ON exp_categories_3.parent_id = exp_categories_4.cat_id
WHERE (((exp_categories.cat_id)={category_id}));
“}
{if c4 !=""} > <a href="###site.com####/categories/C{i4}/">{c4}</a>{/if}
{if c3 !=""} > <a href="###site.com####/categories/C{i3}/">{c3}</a>{/if}
{if c2 !=""} > <a href="###site.com####/categories/C{i2}/">{c2}</a>{/if}
{if c1 !=""} > <a href="###site.com####/categories/C{i1}/">{c1}</a>{/if}
{/exp:query} > {category_name}
<br>
<br>{exp:query sql="SELECT exp_categories.cat_id, exp_categories.cat_name, exp_categories.group_id, exp_categories.parent_id, count( exp_category_posts.entry_id ) AS count, exp_categories.parent_id
FROM exp_categories LEFT JOIN exp_category_posts ON exp_categories.cat_id = exp_category_posts.cat_id
GROUP BY exp_categories.cat_name, exp_categories.group_id, exp_categories.parent_id
HAVING (((exp_categories.parent_id)=’{category_id}’))
ORDER BY exp_categories.cat_name;"}###site.com###/cp_images/cat_marker.gif<a href="###site.com/categories/C{cat_id}/">{cat_name} ({count})</a><br>
{/exp:query}{/exp:weblog:category_heading}
=======================================
I’m changing the design of my website. The design is not finished and most of the new features and menus don’t work yet. However, you can view example of the above code on the following pages ;
