-
☆ A M B ☆
- 1,231 Posts
Has anyone managed to get the &crumbSeparator to actually work? I have just updated one of my sites with the new version and it’s still not working, it never has worked for me in the 2 years I have been using it. I just manually changed it in the snippet code but now I’m sick of doing that lol.
It doesn’t work, but it’s a coding error in the Breadcrumbs snippet itself. I was able to pretty easily fix it.
Problem:
If you specify a custom breadcrumb separator by means of the parameter &crumbSeparator in a call to the Breadcrumb snippet, it is ignored. The default, hard-coded separator is always used.
Cause:
The Breadcrumbs snippet fails to check if the user has specified the &crumbSeparator parameter. It assumes, incorrectly, that the parameter does not exist.
Solution:
1. Open to Breadcrumbs snippet in your ModX installation.
2. Locate the following line: ’separator’ => ’ > ’,
(Note: The default is actually something else; &rqarr; or something like that. I changed it in the snippet in my own installation before seeing this post and deciding to fix it. So, search for "separator", and you’ll find it easily enough.)
3. Replace the line with this:
’separator’ => ( isset($crumbSeparator) ) ? " " . $crumbSeparator . " " : $crumbSeparator = " > ",
(replace the > with whatever you want the default separator to be, in the case that &crumbSeparator isn’t specified.)
This code also ensures that a blank space is added to either side of the separator, so that you get "Home > Next > ThisPage" instead of "Home>Next>ThisPage". If you don’t want automatic spaces on either side of the separator, use this line:
’separator’ => ( isset($crumbSeparator) ) ? $crumbSeparator : $crumbSeparator = ">",
... in which case you’ll need to specify spaces in the value of &crumbSeparator, if you want them.
Result:
Breadcrumbs will now look for and recognize the &crumbSeparator parameter correctly, and use the hard-coded default if no &crumbSeparator is specified. Tested and confirmed on ModX Evolution 1.0.0 with Breadcrumbs 1.0.1