Search code examples
phpyiiframeworksyii-chtml

Create an external URL using Yii CHtml::link correctly


I am trying to create an external URL using the CHtml::link function but it always tries to create an internal link rather than an external link..

So rather than linking to google.com, it is linking to www.mysite.com/www.google.com

Any ideas (ps i know I could write this using standard HTML but i'd link to use the Yii engine as much as possible


Solution

  • This is an example on CHTML link that I used on an image... It linkes the image with google onclick.

    CHtml::link( CHtml::image(Yii::app()->request->baseUrl . '/images/android.png'),('www.google.com'), array('class'=>" "));
    

    Hope it helps!
    Keep on coding!
    Ares.