My site includes listings that have a URL field.
Some people have entered and will enter the website address without the “http://” and therefore when I display these URLs on the site, they do not appear as links.
I have a php function that can convert a URL without the http:// to one with it. However I am not sure how I can use this with EE.
function prependMissingProtocol($sURI)
{
preg_match('#^https?://#i', $sURI) or ($sURI = 'http://'.$sURI);
return $sURI;
}My EE code is as follows:
{exp:channel:entries channel="services" disable="member_data|trackbacks" limit="1"}
{if website}
Website: {website}
{/if}
{/exp:channel:entries}I haven’t done any work using Expression Engine for a few months now so I am a bit rusty. Anyone tell me how I can process this “website” variable with the PHP function?
Thanks
Paul