At long last, we're moving to forums powered by, well, Movable Type itself. You'll want to bookmark http://forums.movabletype.org/ for future reference, and in the meantime you can view these old forums as a read-only archive of past posts. Thanks for being part of the community!
Jun 28 2003, 10:19 AM
Post
#1
|
|
|
Group: Members Posts: 115 Joined: 6-February 03 From: Montevideo, Uruguay Member No.: 7,622 |
There are ways to dirify a tag, to uppper_case it, and to lower_case it. Is there any way to force the first letter to be uppercase, but leave the rest of the word or phrase in lowercase? Make it like a sentence? I want to force conformity in some commenter values, some of which use only lowercase, some of which use sentence-capitalization, some of which might possibly use all caps.
Any ideas? |
|
|
|
![]() |
Jan 11 2009, 04:28 PM
Post
#2
|
|
|
Group: Members Posts: 46 Joined: 2-February 08 Member No.: 52,314 |
Hello (maybe a little late).
QUOTE Is there any way to force the first letter to be uppercase, but leave the rest of the word or phrase in lowercase? I spent last weekend trying to resolve this problem. Searching here, there,, I found this 2 modifiers: <$mt:PageTitle$ capitalize="1"> -> modifies the first char of each word of the phrase to Uppercase <$mt:PageTitle$ upper_case="1"> -> modifies all chars the phrase to Uppercase Then I discovered that if the site is published dynamically in php, php code can be inserted into the templates. So, example: CODE <h1 id="page-title" class="asset-name"> <?php $title = '<$mt:PageTitle$>';echo ucfirst($title);?></h1> --> Only first letter of title Uppercase.But for the search result pages, whose URL is as follows: mt-search.cgi?blog_id=4&tag=tag&limit=20 the previous php code doesn´t works.. so investigating some javascript, I found this solution: CODE <h2 class="asset-name entry-title"><a href="<$mt:EntryPermalink$>" rel="bookmark"><$mt:EntryTitle$></a></h2> <script type="text/javascript"> //<![CDATA[ var x = document.getElementsByTagName('h2'); for (var i=0;i<=x.length-1;i++) { if (x[i].innerHTML == '<a href="http://domain.net/site-path/<$mt:EntryTitle$>/" rel="bookmark"><$mt:EntryTitle$></a>') { var newh2 = document.createElement("h2"); newh2.className = "asset-name"; var hyperlink = document.createElement("a"); hyperlink.setAttribute("href", "<$mt:EntryPermalink$>"); hyperlink.setAttribute("rel", "bookmark"); var title = '<$mt:EntryTitle$>'; title = title.slice(0,1).toUpperCase() + title.slice(1); var text = document.createTextNode(title); hyperlink.appendChild(text); newh2.appendChild(hyperlink); var previoush2 = x[i]; previoush2.parentNode.replaceChild(newh2, previoush2); } } //]]> </script> regards |
|
|
|
losmadden Force first-letter uppercase Jun 28 2003, 10:19 AM
insameluise Eva Jagt Zwei Boxkämpfer Quer Durch Sylt
"capita... Jun 28 2003, 11:01 AM
gvtexas You can achieve sentence case structure with the D... Jun 28 2003, 11:53 AM
kadyellebee I was thinking that the Change Text Case plugin mi... Jun 28 2003, 01:35 PM
losmadden Thank you for the suggestions. From what I can tel... Jun 28 2003, 05:57 PM![]() ![]() |
| Lo-Fi Version | Time is now: 11.25.09 - 01:45 AM |