Jump to content

Recommended Posts

Posted

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>

Posted

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. :-\

Posted

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.

Posted

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?

Posted (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 :D

Edited by kongondo
Posted

This doesn't make any sense :D

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

  • Like 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...