AddonsLab
Well-known member
- Affected version
- XenForo 2.x
Hello,
While working on a project we found out, that it is impossible to add a link in the breadcrumb that links to the current page. This is not something you used in any default XenForo pages, following the standard of having the breadcrumbs to the current page and the page name itself in
The narrowed down the problem to the PAGE_CONTAINER template and "breadcrumbs" macro in it. The loop
The same project was working fine XenForo 2.0.x, and we found the cause to be some unrelated change in 'request.paths' container item, which would return a full URL with scheme and domain name in XenForo 2.0.12, and returns an absolute URL without the domain name since XenForo 2.1.x (did not verify the exact version where the change happened). As a result, the same conditional in breadcrumbs macro would not skip the relative URL and add it to the breadcrumbs.
A temporary workaround for XenForo 2.1.x is to add the breadcrumbs using URL
Not really sure what would be the best to resolve the issue. Maybe this change should be removed from the template, and replaced with a check in PHP in a way that developers can see easier what's going on and why the breadcrumb is missing.
Please let me know if you need any further information from my side.
Thank you!
While working on a project we found out, that it is impossible to add a link in the breadcrumb that links to the current page. This is not something you used in any default XenForo pages, following the standard of having the breadcrumbs to the current page and the page name itself in
xf:h1
tags. but in case of this project, this is a requirement as the page does not have a header text by design, so the name of the page should be included in the breadcrumbs.The narrowed down the problem to the PAGE_CONTAINER template and "breadcrumbs" macro in it. The loop
<xf:foreach loop="$breadcrumbs" value="$breadcrumb" if="$breadcrumb.href != $xf.uri">
explicitely skips any breadcrumb entries that point to the current page, so having xf:breadcrumb
tag in the template is ignored.The same project was working fine XenForo 2.0.x, and we found the cause to be some unrelated change in 'request.paths' container item, which would return a full URL with scheme and domain name in XenForo 2.0.12, and returns an absolute URL without the domain name since XenForo 2.1.x (did not verify the exact version where the change happened). As a result, the same conditional in breadcrumbs macro would not skip the relative URL and add it to the breadcrumbs.
A temporary workaround for XenForo 2.1.x is to add the breadcrumbs using URL
full:prefix
instead of just prefix
and it will not match $xf.uri
anymore.Not really sure what would be the best to resolve the issue. Maybe this change should be removed from the template, and replaced with a check in PHP in a way that developers can see easier what's going on and why the breadcrumb is missing.
Please let me know if you need any further information from my side.
Thank you!