FuturShoc Posted September 2, 2013 Share 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> Link to comment Share on other sites More sharing options...
Adam Kiss Posted September 2, 2013 Share Posted September 2, 2013 Just a blind dab – don't you have something like text-transform: lowercase; in your css? Link to comment Share on other sites More sharing options...
FuturShoc Posted September 2, 2013 Author Share 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. :-\ Link to comment Share on other sites More sharing options...
diogo Posted September 2, 2013 Share Posted September 2, 2013 Does it work with a string? Link to comment Share on other sites More sharing options...
FuturShoc Posted September 2, 2013 Author Share Posted September 2, 2013 Does it work with a string? Oddly, it does not. Link to comment Share on other sites More sharing options...
Soma Posted September 2, 2013 Share 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. Link to comment Share on other sites More sharing options...
adrian Posted September 2, 2013 Share 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? Link to comment Share on other sites More sharing options...
kongondo Posted September 2, 2013 Share 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 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted September 2, 2013 Share Posted September 2, 2013 maybe use: ucfirst(strtolower($page->title)) Link to comment Share on other sites More sharing options...
diogo Posted September 2, 2013 Share Posted September 2, 2013 echo ucwords(strtoupper($page->title)); // MEINE SEITE This doesn't make any sense 1 Link to comment Share on other sites More sharing options...
kongondo Posted September 2, 2013 Share Posted September 2, 2013 Oops! echo strtoupper($title); Corrected.. 1 Link to comment Share on other sites More sharing options...
adrian Posted September 2, 2013 Share 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 Link to comment Share on other sites More sharing options...
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