1

I have a custom field with a person's name in it, and I need to convert it (in the template) to all lowercase with dashes instead of spaces so I can use it as an ID tag. Example:

Suzie McRowdy becomes suzie-mcrowdy

Is there an (ideally free) add-on that will take care of this for me?

2
  • If it's a Matrix field, you could, maybe, use the url-title FT to do the conversion.
    – Eric Lamb
    Commented Feb 12, 2014 at 22:21
  • Can you clarify if you actually want the data in the database updated or keep that data 'as-is' and convert on template output? Commented Feb 12, 2014 at 22:27

3 Answers 3

4

If you need to do this from the template you could use a plugin like this one:

http://devot-ee.com/add-ons/create-url-title

If you need to do it directly to the DB please update us so we can give you that solution as well.

Note: CE String also has a custom method called url_title which will do the same thing but, it's not a free add-on.

1
  • 4
    Also of note, plugins can be used as formatting filters too. Check this screenshot: cl.ly/Tsdy You can click Edit List, enable your plugin there, and select it in the list, forcing that format on the content of your field. Commented Feb 12, 2014 at 23:32
2

I did this with CE String:

<a href="{url}" class="icon-{exp:ce_str:ing url_title}{label}{/exp:ce_str:ing}">{label}</a>

You can see the docs here

The reason I like this method is CE String is super helpful across most site builds. It has so many useful features!

1

You could also use Low Replace (which is FREE!):

http://gotolow.com/addons/low-replace/docs#tags

I haven't used it for adjusting the case of outputted data but it is supported.

That should get you started!

Your Answer

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

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