Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

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?

share|improve this question
    
If it's a Matrix field, you could, maybe, use the url-title FT to do the conversion. –  Eric Lamb Feb 12 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? –  Iain Urquhart Feb 12 at 22:27
add comment

3 Answers

up vote 4 down vote accepted

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.

share|improve this answer
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. –  Jeremy Gimbel Feb 12 at 23:32
add comment

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!

share|improve this answer
add comment

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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