I am having an issue with the breadcrumbs auto-generated list. It does not seem user-friendly, though it is programmatic or logically correct. Due to my unfamiliarity with the code that "constructs" the breadcrumb trail, I am having difficulty making it do what I believe is more user-friendly.
The way the trail is constructed now, simply shows the "programmed" structure of the current location. This would be fine, except it consumes a lot of space, is hard to follow, and brings you to places you never came from.
SAMPLE: (Original BB structure)
Board Index (Contains two categories, each having two forums and two categories)
- (C) Members (Contains two categories and two forums)
- - (F) Rules
- - (F) Help
- - (C) Off-topic
- - (C) States
- (C) Guests (Contains two categories and two forums)
- - (F) Rules
- - (F) Help
- - (C) Off-topic
- - (C) States
All of the above is seen on the initial "Board Index". The "Members" and "Guests" categories simply show as a grouping title to the two separate groups. Each of the groups shows four sections, two are forums, two are categories with forums inside them.
At this point, the breadcrumb trail indicates "Board Index". This is odd, because you have not gone anywhere, so there should be no trail to follow home. You are home. (Below, I have replaced that first "Board Index" text-link with an icon that brings you home. Where you are now.)
If you select the "States" link, from the "Guests" category... The resulting breadcrumb and page-link is...
(Breadcrumbs) Board Index >> Guests >> States
(Duplicate page link) States
Though you only went one place, it seems as if you have gone two places. You seem to have gone to "Guests" and then to "States". This is partially confusing because the page identifies itself as "States", which is also a link. The two links that say "States" are not needed. You will never need to click that link to return where you are already at.
If you click the "Guests" link. You appear to be back on the "Board Index", except the entire "Members" category has now disappeared. (You are in a special page that simply has this single category listed.) Nothing in, or on the link, has indicated that it was a category. Most people expect to return to the LEVEL, not the segregated division of a LEVEL, when they click on a link. Just as they expect to return one LEVEL/PAGE back, when clicking the back button.
What should have happened when the user selected "States" from the "Guests"...
(Breadcrumbs) [HOME ICON] >> Guest >>
(Page title that is not a link) States
("Guest" would link back to "Board Index", where that category was found. "States" would just be a text title, letting you know where you are. It would not be a link back to this page, where you are now.)
This is where I get in over my head. The breadcrumbs trail is processed logically and methodically, without formal structure. It is just a loop of literal calculated form, based off the structure you have programmed, without consideration for the resulting visual output/display of the resulting forum formal structure.
I found the code that handles the loop, but I am unsure how to detect these categories that are not acting like forums, so they can be excluded from the link-building process. I believe I can strip the last-link, as it is just a duplicate of the link on the page, which I also want removed.
The code excerpt is below... (Found in "functions_display.php")
Code: Select all
/**
* Create forum navigation links for given forum, create parent
* list if currently null, assign basic forum info to template
*/
function generate_forum_nav(&$forum_data)
{
global $db, $user, $template, $auth, $config;
global $phpEx, $phpbb_root_path;
if (!$auth->acl_get('f_list', $forum_data['forum_id']))
{
return;
}
// Get forum parents
$forum_parents = get_forum_parents($forum_data);
// Build navigation links
if (!empty($forum_parents))
{
foreach ($forum_parents as $parent_forum_id => $parent_data)
{
list($parent_name, $parent_type) = array_values($parent_data);
// Skip this parent if the user does not have the permission to view it
if (!$auth->acl_get('f_list', $parent_forum_id))
{
continue;
}
$template->assign_block_vars('navlinks', array(
'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false,
'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false,
'FORUM_NAME' => $parent_name,
'FORUM_ID' => $parent_forum_id,
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id))
);
}
}
$template->assign_block_vars('navlinks', array(
'S_IS_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_IS_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_IS_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_ID' => $forum_data['forum_id'],
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data['forum_id']))
);
$template->assign_vars(array(
'FORUM_ID' => $forum_data['forum_id'],
'FORUM_NAME' => $forum_data['forum_name'],
'FORUM_DESC' => generate_text_for_display($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options']),
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
));
return;
}
Code: Select all
<p class="breadcrumbs"><a href="{U_INDEX}">{L_INDEX}</a><!-- BEGIN navlinks --> » <a href="{navlinks.U_VIEW_FORUM}">{navlinks.FORUM_NAME}</a><!-- END navlinks --></p>
Code: Select all
<a href="{U_INDEX}">{L_INDEX}</a>
Once I figure this out... I also want to deal with the overly-large breadcrumb trail that gets created. I would like to reduce it to four links and the HOME icon. The missing or clipped links would be replaced with a "..." to signify that the breadcrumb was truncated. This clipped area would be the portion between the HOME icon and the last four links. (I expect to have around six levels deep, at some point in the near future.) The "..." will actually be a link to the location that is one level higher than the following text-link level.
EG...
[HOME] >> ... >> Some Group >> Another Group >> One More >> Oops Again >>
"Page title that is not a link"