Closed (won't fix)
Project:
Custom Breadcrumbs
Version:
5.x-1.2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Oct 2007 at 03:52 UTC
Updated:
24 Nov 2012 at 05:04 UTC
Hi,
I am trying to figure out how to make my custom breadcrumbs' paths to be lowercased. For example, I am using the CCK text tokens of select drop-down fields that contain values such as Apples, Bananas, and Oranges. However, when using the CCK text token for dynamically creating paths, the URL for the breadcrumb shows up something like mysite.com/Apples, when it should be mysite.com/apples to display the page correctly. Perhaps there is some way via PHP to automatically make the path lowercased?
Thanks!
Comments
Comment #1
eaton commentedThis should be pretty straightforward, but I'm concerned that it might cause problems with other paths. I'd hate to add yet another setting/preference to the module just to toggle lowercasing. I'll think about this one for a bit...
Comment #2
TBarregren commentedkoro,
Have you consider to theme your breadcrumb instead? Put the code snippet below in your template.php file.
Comment #3
jody lynnIf anyone else is interested I just had to do the same thing and I just added a strtolower (string to lower) so that function custom_breadcrumbs_nodeapi became
Custom breadcrumbs rules by the way. How else would I ever get my crazy directory location view to end up on a single node without anyone being able to tell I went from view to node? This made the complex oh so simple.
Comment #4
scottrigbyI wish this worked for me, but it doesn't seem to (this solution just above, to change the module). Perhaps I'm doing something wrong?
I'm using the zen_basic theme, in case that's relevant.
The solution slightly farther above (to add a function to template.php) works fine to make the breadcrumb appear lowercase, but I can't seem to figure out how to make the link itself lowercase for Category terms that are uppercase.
Do you have any other ideas?
Thanks in advance!
:)
Scott
Comment #5
avolve commentedyou can use CSS to change case
Comment #6
scottrigbyavolve – this issue just above was about making categories appear lowercase in the URL (when added using token)... not about the breadcrumb display, which you're right, can be changed with css.
This is a bit of an old issue at this point, and I wonder if it has been solved since? Personally I have had to use a different solution (than using categories in the url) because this didn't work for me.
Any advice is welcome :)
Comment #7
avolve commentedmy mistake, sorry. Only skimmed through this looking for guidance on another issue (views breadcrumbs).
Comment #8
ergunk commentedThank you Jody Lynn, your code worked for me(Drupal version: 6.8). I used only
strtolower(trim($paths[$i]))part. Other solutions(CSS and template.php hack) lowercase both link text and URL, but Jody's code lowercases only URL.I want to share how it worked:
In custom_breadcrumbs.module file, in
function custom_breadcrumbs_nodeapi($node, $op, $teaser, $page)function, i changed the code parttrim($paths[$i])asstrtolower(trim($paths[$i]))That's all.
I would not prefer to change any module code; but i tried a lot of things and code hack was the only way. :(
I also want to thank to Eaton for this nice module.
Comment #9
ergunk commentedUpss!
It did not work for Turkish paths/terms. Jody's code might still be useful for some issues, but for terms, i realised a better way. No code changes, no another hacks(so i reverted the module file). The solution was there already. My mistake :(.
Solution is to use [termalias] token for path, not [term] or [term-raw]:
Titles: [term]
Paths: [termalias]
PS: Module version: 6.x-1.4
Comment #10
NickWebman commentedTbarregren: that code whitescreens my site.
Comment #11
NickWebman commentedAfter googling my face off, here is how I did it, code-free...
1. Install pathauto if you haven't already. Get into the pathauto settings...
Site building › URL aliases › Automated Alias Settings (how confusing is it to have Pathauto labeled "Automated Alias Settings"?)
2. Under "punctuation settings", change "Slash /:" to "no action". Otherwise, your paths will remove forward slashes andyoururlstructurewilllooklikethis.
3. Then go to the custom breadcrumbs page and make them look like this (for example)...
<pathauto>|whatever/[term-raw]/[title-raw]The
<pathauto>part tells Custom Breadcrumbs to apply the rules set inpathautoto the breadcrumbs. If you just use "whatever/[term-raw]/[title-raw]", and don't drop in the<pathauto>deal, you'll get caps. If you don't change the punctuation settings (the "Slash /:"), the urls will be smooshed together with no slashes.4. Make sure not to use slashes in your titles (not sure why you would anyhow), or else you'll have bogus url structure.
I feel like this should be made a bit easier, no? or perhaps they should be lowercase by default?
Comment #12
plan9 commentedN1ckhead's solution is for 6.x version - not 5.x-1.2 (which is the version the issue is raised for).
Comment #13
plan9 commentedA solution for 5.x-1.2 is to change line 59 in custom_breadcrumbs.module from:
to:
Comment #14
colanThe 5.x branch is no longer supported.