Closed (fixed)
Project:
Drupal core
Component:
base system
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
13 Jan 2004 at 20:56 UTC
Updated:
20 Aug 2004 at 23:20 UTC
Jump to comment: Most recent file
drupal_get_title() automatically capitalizes the page title. that's annoying in some cases. this should be a theme decision. for an example of why that stinks, see http://drupal.org/cvs. The title is Cvs. Feh
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | no_ucfirst_title.patch | 434 bytes | Chris Johnson |
Comments
Comment #1
ax commentedsee also [drupal-devel] PATCH: ucfirst and accented chars (and thread). +1.
Comment #2
kyber commentedI agree. also screwed up my bug report where I started title with a method name.
I stripped it from parts of our system a while ago since it was messing with titles of poems where users had deliberately not capitalized title for stylistic reasons of their own.
Just a pointless feature, IMO. If people want capitalization in a title, they can darn well press the shift key.
Comment #3
skip commenteddouble plus 1.
Either let the posting user capitalize, or have it in the CSS.
Comment #4
gábor hojtsyThe automatic capitalization is in place so pages can have nice default titles. A lot of pages use their default titles derived from the URL's registered menu item's title, which is completely lowercase most of the time... Still I would also like to see the uppercasing delegated to the theme, so people can decide themselfs... This is a presentation issue anyway...
I am hopeful that if someone submits a proper patch, Dries will not complain much :)
Comment #5
Chris Johnson commentedPatch attached.
Comment #6
dries commentedThat patch makes the titles look ugly - see Goba's explanation. A proper patch that updates the theme system (themes) is required for this to be evaluated.
On a related note, how about capitalizing the breadcrumb trails or delegating capitalization thereof to the theme system (themes)?
Comment #7
gábor hojtsyIn reply to the related note from Dries, since I am already using a hacked up theme which capitalizes the breadcrumb items, I am all for capitalizing them too :)
Comment #8
skip commentedYou could have it both ways by adding an 'id' attribute to the tag that holds the title (and the breadcrumb), and then 'text-transform: capitalize;' in the theme's CSS file.
Although... I guess that would capitalize every word in the title/breadcrumb...
How about having drupal_get_title() put a span around the first word of the title (w/ an id="capitalize") and then adding the text-transform CSS to the drupal.css file. Then, none of the themes would have to be messed with... and it can still be overridden on a theme-by-theme basis.
I can write up a patch if y'all like that idea.
Comment #9
gábor hojtsyPlease look for all ucfirst() usages!
Comment #10
dries commentedI think the majority of the people want to capitalize the first work of their page titles and breadcrumb trail so IMO, that should be the default behavior. No?
Comment #11
gábor hojtsyYess...
Comment #12
Chris Johnson commentedMajority of which people, Dries?
I don't want Drupal core automatically capitalizing any of my text (or any other unasked for transformation).
Core should provide services, themes should provide viewing styles, and site admins and users should choose which transforms (e.g. HTML filters, text transforms, spelling correction, etc.) they want applied to their content. Otherwise, we might as well sprinkle HTML through the core and make database changes in the themes. What's the point of having logical architecture layers (separation) if one doesn't stick to it?
As for where ucfirst is used -- from last night's CVS:
64 host9:~...cms/dev-drupal> fgrep -rl ucfirst *
includes/menu.inc
modules/archive.module
modules/help.module
modules/user.module
modules/title.module
modules/tracker.module
themes/xtemplate/xtemplate.theme
Comment #13
dries commentedWhat I said (or meant to say) is: the behavior should be themeable but we should try to choose a sensible default -- we have defaults for any theme function. I think the default behavior should capitalize titles and breadcrumb trails.
Comment #14
skip commentedI agree that the default should be uppercase... I just think that it should be done in a way that can be undone.
Using CSS (rather than ucfirst) would give admins the option of changing the default behavior, and it wouldn't be very complicated to implement.
>>What I said (or meant to say) is: the behavior should be themeable
>>but we should try to choose a sensible default -- we have defaults
>>for any theme function. I think the default behavior should
>>capitalize titles and breadcrumb trails.
Comment #15
dries commentedBut how to do it using CSS? Wrapping the first word in <span class="first-word"></span> looks somewhat clumsy to me.
Comment #16
skip commentedWell, I did a bit of experimenting (w/ my CSS book in hand)... and it "should" be easily done with the :first-letter pseudo class.
i.e. #pageTitle:first-letter { text-transform: capitalize; }
but... considering the level of support for pseudo classes right now, I don't think that's a reliable option.
My brief test with Safari mangled it up pretty bad.
I don't think putting the span in there is that bad (for the flexibility it offers), but that's just me.
Comment #17
dries commentedBeside CSS pseudo-classes not being widely supported, it degrades not as nice as using
ucfirst(). A detail, I know.Comment #18
moshe weitzman commentedwrapping the first word in a span seems reasonably elegant to me. i can't think of a better solution.
Comment #19
axel commentedSadly, this thing move to 4.4 release. +1 for removing ucfirst if it not removed while.
For my site I try workaround with setting proper locale for script. For example for Russian environment:
setlocale(LC_ALL, "ru_RU.utf8")
...but later me simply remove ucfirst() from common.inc and problem with titles disappear. Let's users more freedom with choice Capitalize or not their posts.
Comment #20
killes@www.drop.org commentedDrupal should not interfere with user input without any feedback. If a site admin wants users to capitalize the first word in their postings, that admin should create a module that implements the _nodeapi("validate") hook and rejects improper formatted postings. In other words: ucfirst should be removed.
Comment #21
dries commentedI'm OK with removing instances of
ucfirst()(though that does not seems to solve the themability issue).Comment #22
dries commentedComment #23
jonbob commentedThis is now done via CSS, so the theme can override this behavior.
Comment #24
(not verified) commented