• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

As designed  Possible thread title bug?

Rudy

Well-known member
#1
I was trying to post a song title in quotes in one of my threads, and the first word ended up being lowercase. I have set XF to make thread titles have each word capitalized. My thread title is:

Shootout: "Yeh Yeh"

...but it is coming out as:

Shootout: "yeh Yeh" .

I have checked it and tried to correct it a few times, but I think the quote character is being considered the first "letter" in the word, as it keeps hopping back to the second version after I submit my thread edits.

Either that, or my "allnighter" last night is catching up to me... ;)
 

Kier

XenForo Developer
Staff member
#2
This is just the way ucwords() works in PHP - it's a pretty extreme edge case so it's really not worth spending the effort to roll our own version for these rare occasions when a non-alphanumeric character is used as the thread title start.
 

Rudy

Well-known member
#3
That's odd that ucwords() would consider punctuation to be a valid character--I would argue it's a bug in PHP. I wasn't sure if you were using ucwords() or were doing it your own way. I just peeked at php.net/ucwords, and there are all sorts of comments about other ways to to it (and most of them are quite sloppy coding IMHO). Best to leave it alone, I would think.

I am going to end up disabling it since there are acronyms which get changed also. PHP becomes Php. ;) A lot of our dicussions involve acronyms. My main issue is that I'm very particular about grammar, and want to avoid those small handfuls of members who write their titles all in lowercase...

Thanks Kier!
 

Cezz

Well-known member
#4
This is more of an annoyance than a bug, but when you enable Automatically Adjust Case t0 Title case it doesn't capitalise the first letter in a word but the first character, what I mean by this is that if you add quotations or any other punctuation at the beginning of a word the first letter is automatically forced to lowercase with no way of overwriting this looks very weird.

An example Title
"The Book Of Splendour" By Frances Sherwood
Would get changed to
"the Book Of Splendour" By Frances Sherwood
--------------

Another Example is
[Book of Month] Some Random App
Would get change to
[book Of Month] Some Random App
Now I haven't really looked into how the Automatic adjusting works and if it is simply using a function that is part of Zend but it seems like it should ignore this sort of punctuation and only capitalise the first letter of Words...
 

Cezz

Well-known member
#6
Ahhhh thanks Brogan, did try searching and didn't find anything... lucky this feature isn't turned on here though or the [Duplicate] tag you added to the title would actually become [duplicate] :p

Any chance this thread could be merged with the dupe? So that my additional examples would be included!
 

brendanc

Active member
#8
If I may be so bold as to suggest you might have some luck using CSS to fix your capitalization woes?
text-transform:capitalize; can capitalize all the words in whatever selector you want, so you could do:

.titleBar h1 { text-transform:capitalize; }

And I believe that will accomplish what you want without changing anything on XenForo's side.