4

I'm using the {segment_2} variable to complete various bits of info on a page. The segment is all lowercase, but that's fine as I'm using CSS to capitalize those elements.

The problem comes when I'd like to use that {segment_2} in the page title. It's appearing all in lowercase and I can't figure out how to make it appear in sentence case.

Any ideas would be appreciated!

Thanks in advance,

Tom

1

2 Answers 2

7

Install the Streeng plugin.

Perform common operations on strings. Change case, truncate, find/replace, repeat, encode/decode, generate slugs and more.

One of the parameter options is capitalize="yes" which lets you capitalize the first character of the string.

1
  • Please select my answer as correct if this worked for you
    – Anna_MediaGirl
    Nov 21, 2013 at 15:57
6

CE String is another great option.

CE String is a string manipulation tool for use in your ExpressionEngine templates. It is feature-packed, and allows you to manipulate strings (text) with very simple syntax.

You would just do:

{exp:ce_str:ing strtoupper}{segment_2}{/exp:ce_str:ing}

CE String has tons of other useful methods. And the chaining feature that lets you use more than one method can come in handy.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.