How to use CHtml::link when we don't know whether the link will point to an internal or external link

Hello,

I tried using CHtml::link to make links that can be customized via the backend, so the URL can either be an internal URL or an URL pointing to an external site.

If I put the URL inside an array, then it will generate an URL like this index.php?r=h*tp://www.mydomain.com.

If I don’t put it in an array, then internal URLs will be broken.

How should I approach this?

Thanks.

Well that depends, in our CMS we have the links typed, that is we have: application, domain, other.

Application means its an internal link, and domain its an external link, other i dont remember whats for, but other than typing the link I can only think of checking for ‘http://’ existence, but what would require some backend validation when creating the link, like checking if the user added the ‘http://’ or not.

I guess that’s the only solution seeing how CHtml::normalizeUrl works…

Thanks a lot :D