2

In EE the "URL Title" field is automatically built based on what you enter in the "Title" field. Is it possible — with an extension or otherwise — to build the URL Title from a different, or better yet multiple fields?

For instance, I have three fields on my publishing page: First Name, Middle Name / Initial, and Last name. I'd like the URL Title to be firstname-middleinitial-lastname.

is this possible?

2 Answers 2

6

There's plenty of addons already out there:

0
4

You can most definitely do this. Just use the channel entries API hooks. You can use a conditional to test to make sure your logic performs only for new records vs. edit. It would actually be relatively easy to do. The most time consuming part would be adding a settings pane so you could use a UI to building the URL titles on a per channel basis (for example). Alternatively, use config files to avoid writing all the UI logic. I would likely opt for the config route if I wasn't going to sell such add-on commercially.

Basically once the hook triggers, perform any conditionals required. If the conditionals pass run a simply database query to update the fields using the settings array generated from a UI or config file.

http://ellislab.com/expressionengine/user-guide/development/extension_hooks/api/channel_entries/index.html

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.