We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Proper Titles

Development and Programming

Sean Sperte's avatar
Sean Sperte
63 posts
17 years ago
Sean Sperte's avatar Sean Sperte

There’s gotta be a better way than this:

{exp:widont}{exp:smarty_pants}{exp:title_case}{title}{/exp:title_case}{/exp:smarty_pants}{/exp:widont}

Anybody care to whip up a pi.proper_title.php? 😊

       
Leevi Graham's avatar
Leevi Graham
1,143 posts
17 years ago
Leevi Graham's avatar Leevi Graham
There’s gotta be a better way than this:
{exp:widont}{exp:smarty_pants}{exp:title_case}{title}{/exp:title_case}{/exp:smarty_pants}{/exp:widont}
Anybody care to whip up a pi.proper_title.php? 😊

Why not use CSS?

text-transform:capitalize
       
Sean Sperte's avatar
Sean Sperte
63 posts
17 years ago
Sean Sperte's avatar Sean Sperte
Why not use CSS?

I’m trying to accomplish much more than what CSS is capable of. For starters, the text-transform property is extremely inflexible, capitalizing every single word – which contradicts nearly every style guide known to man. I’m also wanting to convert special characters into HTML entities on the fly (using Smarty Pants); as well as prohibit widows.

       
Will Bolton's avatar
Will Bolton
30 posts
17 years ago
Will Bolton's avatar Will Bolton

Have you tried the Typogrify plugin? It’s essentially a port of the Django plugin of the same name and incorporates widon’t and smartypants.

You can use it with the Title Case plugin provided you edit pi.title_case.php first to check for and include pi.typogrify.php instead of pi.smarty_pants.php. That way you can use the following:

{exp:typogrify}{exp:title_case}{title}{/exp:title_case}{/exp:typogrify}

Which is a small improvement, right?

       
Jacob Fentress's avatar
Jacob Fentress
37 posts
17 years ago
Jacob Fentress's avatar Jacob Fentress

@Sean

I have been struggling with the same thing. That is why I created the Title Case plugin to begin with (based on John Gruber’s script), but I wasn’t happy with that. I then required that SmartyPants be installed (the latest version makes it optional) to fix issues with straight quotes (and to use that SmartyPants typography goodness that I love so much) without having to wrap my titles in another plugin. I figured if you were going to go to the trouble of using Title Case, you wanted your titles to be properly formatted, so you’d want SmartyPants applied as well.

Following that reasoning, perhaps it would be good to apply widon’t as well if it is installed.

And if I do that, should the plugin be renamed to “Proper Title”?

@Leevi

Text-transform capitalizes every word (I’m assuming that how people would be setting text-transform, which, obviously does different things depending on how you set it), which is not proper formating for titles. Small words should be lowercase, etc.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.