Topic: Adding 'category' to breadcrumb trail in viewtopic and viewforum
Is there an easy way to add the current category identifier to the bread-crumb navigation in viewtopic.php and viewforum.php?
At the moment, for example, in viewforum.php at the top of the page you see:
'Index >> forum name'
and in viewtopic.php you see:
'Index >> Forum name >>Test post'.
I would like to see this line read, for example in the case of viewtopic.php:
'Index >> Category name >> Forum name >> Test post'.
The category name needn't form a link.
In looking at the code in index.php, where the category names are displayed, the category name is extracted as part of a complex query:
$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.forum_desc, f.redirect_url, f.moderators, f.num_topics, f.num_posts, f.last_post, f.last_post_id, f.last_poster FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE fp.read_forum IS NULL OR fp.read_forum=1 ORDER BY c.disp_position, c.id, f.disp_position', true) or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error());
which helps make the string
<?php echo pun_htmlspecialchars($cur_forum['cat_name']) ?>
which is used to display the category name in the HTML of index.php.
However viewforum.php and viewtopic.php don't run the same query and so the same code doesn't display any category name.
Is there an easy way to get this information to display on viewforum and viewtopic?
I mean it's there in index.php and also in the (cached) quickjump box that's already visible on both viewtopic and viewforum.
What I guess I want to avoid is adding another query into those pages to extract the current category name out. Is it floating around somewhere else?
As you can guess, I am not that confident in my PHP