I am not sure if this is a bug or pathauto intends that letters in uppercase becomes lowercase.
If this is a bug, well...then letters in uppercase are transformed to lowercase. If relevant, I am running pathauto.module,v 1.22.2.9 2006/10/22 21:51:09
if this is intended and therefore isn't a bug then please consider this as a support/feature request.
For example:
nodetype IS blog.
nodepath settings/pattern for all blog paths is [user]/Blogs/[catpath]/[title]
and my categories are actually all capitalized eg. Travel
eg. title is Oslo by Night, user is JohnNoc
separator is -
so instead of having: www.example.com/JohnNoc/Blogs/Travel/Oslo-by-Night
I get: www.example.com/johnnoc/blogs/travel/oslo-by-night
Thanks!
John
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | leave_patterns_alone_on_variable_get_106296.patch | 1.98 KB | greggles |
| #17 | leave_patterns_alone_on_variable_get_106296.patch | 1.3 KB | greggles |
| #5 | pathauto.module_13.patch | 2.28 KB | jaydub |
Comments
Comment #1
JohnNoc-old commentedThis page was duplicated...sorry... but this is the correct one.
Comment #2
gregglesYes, it is currently by design that it works this way and have changed the status, version, and category to correspond. I set it to postponed just because I'm not going to work on it. If someone else wants to assign it to themselves and work on it then they should take it out of postponed.
If we implement it then the best way will probably be an option for the user to specify whether they want:
1. leave the pattern alone (e.g. if it comes in as JohnNoc then leave it as JohnNoc)
2. lowercase the pattern (e.g. if it comes in as JohnNoc then turn it into johnnoc)
Perhaps there is another option (uppercasing the pattern, or mixed-casing it) though I don't think those would be popular.
Do you have any thoughts on how to implement this in the UI?
My initial thought was just radio buttons or a checkbox.
My second thought was that we could use the pattern to indicuate how it should be treated so that:
[user] indicates that you want it to be lowercased
[User] indicates that you want it to just be left alone (e.g. don't change the case of the characters)
[USER] indicates that you want it to be turned into caps
That would add some complexity in the replacement of the strings, but provides the option of casing without requiring yet another checkbox and allows for very granular control over the patterns.
Comment #3
JohnNoc-old commentedHi! Thanks for looking into this. I just hope that someone takes the time in trying to implement this :-)
Anyway, regarding your thoughts on the matter.....
Personally, I prefer the radio button over the checkbox and over the use of patterns-per-path-setting. A checkbox, in my opinion, connotes multiple selection, (eg. check which are appropriate) whereas a radio button gives an either-or connotation, don't you agree? And in this case, a user cannot choose more than one option, either 'all lowercase' or 'Leave-As-Is".
Regarding using patterns to indicate how capitalization should be treated, giving that much freedom of choosing different patterns per nodetype, Category, blog, User-Tracker, USER, etc. opens up the possibility of url clutter for the site. It will be confusing to site visitors. IMO, it will be a step backward for websites and is not so Web 2.0/3.0's "well-formedness".
To illustrate that patterns-per-path-setting looks dirty:
www.example.com/User/greggles/BLOG/Blog-Title
www.example.com/articles/Article-Title
www.example.com/Books/book-path/Page-Title
www.example.com/IMAGES/Category/image-title
www.example.com/contact-us
www.example.com/Front-Page
www.example.com/User/greggles/TRACKER
of course a user can make sure that all nodetypes look the same, all titles look the same but if users dont have a choice on this, it's like we are assuring that url of drupal powered sites, even if they have the freedom and the power of creating aliases, will still be well-formed. Does that make sense?
So site-wide, it's either all are in lowercase (most-widely used) or leave-as-is (for URLs to be contextual, and well-formed)....and selected via a radio button
Selling points to Drupal coders: The feature....
www.example.com/reviews/RoboHelp
www.example.com/reviews/phpMyAdmin
www.example.com/reviews/ColdFusion
www.example.com/DVD/titles/Rocky-Balboa
I believe that this will be a great feature for Drupal sites. Are you convinced now? :-))
Thanks for taking the time in reading this looooong comment.
John
Comment #4
gregglesHi John,
First, thanks for the long and well thought out response. I do appreciate you spending time and providing such a well thought out analysis.
That said - I'm not interested in spending my free time on it but perhaps someone else will be. If you or anyone else creates a patch and provides guidance on how to test it I'd be happy to review and apply.
Thanks again.
Comment #5
jaydub commentedI just ran into this very same issue today so here's my attempt at a patch. this is for the latest 4.7.x module. I created a radio option in the settings where value of 0 is keep lowercase and value of 1 is maintain user's case. I searched and found 3 calls to drupal_strtolower and just wrapped those 3 function calls in IF..THEN tests based on the value of the setting.
A quick test seems to be ok...feel free to try out and let me know.
Comment #6
gregglesIt's a feature request so it needs to be for 5.x and not 4.7.
Thanks for rolling this, though. Hopefully it will be small change for 5.x.
Comment #7
gregglesI just took a closer look and would port this to 5.x-
However - it's not clear to me why you removed the strtolower on the variable_gets:
that seems like it's intended to remove the situation of an admin who sets [Title] and then gets the literal "[Title]" in the URL rather than the replacement. I think we should leave those two in the code unless you are seeing something that I'm missing.
Comment #8
Eep commentedSubscribing... (what kind of forum doesn't have a way to subscribe without having to post? sheesh)
Comment #9
greggleschanging version to the right one (no new features in 1.x).
See http://drupal.org/node/34496 for information on subscribing without followup.
@eep, you would endear yourself to the community if you 1) searched for issues prior to complaining about them 2) worked to fix some of them instead of complaining.
Comment #10
Eep commentedI complain when something isn't easy. Each issue/thread should have a "subscribe" button in the thread, as is common in, oh, just about every forum software out there--except Drupal's, that is.
If no one complained, everyone would think everything was just fine, but it's not. :)
Comment #11
gregglesI committed a variation of what jaydub had created to the 5.x-2.x branch.
Thanks everyone for your ideas, code, and reviews.
Comment #12
David Latapie commentedJust to subscribe to the issue.
Comment #13
David Latapie commentedComment #14
greggles@david lataple - please note that this is already implemented on the 5.x-2.x branch. So, you should be able to just use that to test out the feature.
Comment #15
(not verified) commentedComment #16
J-K@www.drupalcenter.de commentedI don't know, if the right way is to re-active this issue or if i should create a new issue.
Although the option "Character case" is set to "Leave case the same as source token values.", my path becomes lowercase: In fact, for example my pattern for all image paths is "Bild/[title-raw]" (without quotation marks of course).
But pathauto generate a path like "/bild/Title". The spelling of [title-raw] is correct, but my static text "Bild" becomes lowercase.
Why?
Is there a way to correct this behavior?
Thanks,
J-K
Comment #17
gregglesWell, this seems to be caused by the following code:
Which was added (more or less, it's been modified a couple times, but look for the strtowloer(variable_get( in http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/pathauto/pa...
That's revision 1.1.2.1 from February of 2005. So, I guess it's just always been this way. The only reason I can imagine that this would be a problem is if an admin sets something like [Title-raw] as the token, but our token checking should fix that, so...I'm inclined to switch this around. Please test the attached patch.
Thanks.
Comment #18
J-K@www.drupalcenter.de commentedYes,
the patch fixed it!
THANKS!
I'm not sure if it belongs to this, but in pathauto_node.inc , line 53 there is also code with strtolower:
J-K
Comment #19
gregglesupdated patch to include that change. Your catch made sure this will work for bulkupdates as well.
Applied to DRUPAL-5--2 - 6.x coming soon.
Comment #20
gregglesAnd to 6.x.
Thanks for the quick testing and for the additional change, J-K!
Comment #21
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.