FuturShoc Posted September 2, 2013 Posted September 2, 2013 I can see no reason this wouldn't be working, but it isn't capitalizing my page title. <h1><?php echo ucwords($page->title); ?></h1>
Adam Kiss Posted September 2, 2013 Posted September 2, 2013 Just a blind dab – don't you have something like text-transform: lowercase; in your css?
FuturShoc Posted September 2, 2013 Author Posted September 2, 2013 Just a blind dab – don't you have something like text-transform: lowercase; in your css? I don't, no. I'm even looking at the page source and the caps are not getting applied. :-\
FuturShoc Posted September 2, 2013 Author Posted September 2, 2013 Does it work with a string? Oddly, it does not.
Soma Posted September 2, 2013 Posted September 2, 2013 Works fine here echo $page->title; // meine seite echo ucwords($page->title); // Meine Seite Also ucwords isn't multibyte save. So special chars don't get uppercase.
adrian Posted September 2, 2013 Posted September 2, 2013 Is the page title already all caps? ucwords needs a strtolower first if that is the case. Although you tested diogo's suggestion, so I am guessing this is probably not the problem unless the string you tried was all caps as well. Do other php functions work in that context, or is it just ucwords that doesn't work?
kongondo Posted September 2, 2013 Posted September 2, 2013 (edited) Works fine here... echo $page->title; // meine seite echo ucwords($page->title); // Meine Seite echo ucwords(strtoupper($page->title)); // MEINE SEITE echo strtoupper($page->title); // MEINE SEITE (btw) Edit: Corrected nonsensical code Edited September 2, 2013 by kongondo
Martijn Geerts Posted September 2, 2013 Posted September 2, 2013 maybe use: ucfirst(strtolower($page->title))
diogo Posted September 2, 2013 Posted September 2, 2013 echo ucwords(strtoupper($page->title)); // MEINE SEITE This doesn't make any sense 1
kongondo Posted September 2, 2013 Posted September 2, 2013 Oops! echo strtoupper($title); Corrected.. 1
adrian Posted September 2, 2013 Posted September 2, 2013 This doesn't make any sense Actually I think it is kind of a useful example that highlights what Martijn and I said above. ucwords won't work on capitalized strings, which is why that example of kongondo's doesn't show Meine Seite 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now