TitleCased
Question
When I have a title for a page, I want it to only capitalize the words that are supposed to be capitalized in my language.
Answer
This recipe does just that. You assign the words you don't want upper cased, and this script does the rest. The list of lower cased words comprises common English words. For what its worth, the "rule" for lower casing is all articles (a, an, the), conjunctions (e.g. and, but), and prepositions of less than five letters (e.g. we lower case "from" but not "Until"). The list is not comprehensive.
include_once("$FarmD
/Cookbook/titlecased.php");
Notes
- This recipe was last tested on PmWiki version: 2.1-Beta14
- This recipe, version v1.0 was installed here December 13, 2005
Releases
- v1.1 - Updated for PHP5 (
preg_replace
, etc.) Said Achmiz September 17, 2017, at 10:05 PM - v1.0 - Originally written, based on an earlier discussion with others on the discusion list. I've used this for months now Dec 13, 2005 BenWilson
Comments
See Also
Contributors
- BenWilson - Author
User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.