What's the best way to make sure external URLs aren't interpreted as relative links? I have a field where the client can enter a URL, and then that field's value is put into the 'href' of a link in the template. The client will sometimes prepend it with "http://", sometimes with "www.", and sometimes with nothing. Unless it's prepended with "http://" or "https://", the link is interpreted as relative and tries to go to "http://mysite.com/www.otherlink.com", which is obviously not what I want.

What's the best way of automatically handling different URL formats?
Using Craft, you could go two ways:


Make your own field-type, that handles the url in PHP and appends http:// if needed (Create a plugin for that)
Check the url for 'http' in your template, and if needed prepend it:

{% set url = entry.url | slice(0,4) == 'http' ? entry.url : 'http://' ~ entry.url %}



Be sure to use the {% cache %} tag if you use option 2, so the check only has to be done once.

Edit: You could use this plugin to pre-validate your urls.