Question

I've used the CHTML::link() to create links however it doesn't seem to work for absolute URLs

My Code:

<?php echo CHtml::link(CHtml::image(Yii::app()->baseUrl.'/images/image.png'), array('/http://www.newsite.com/about/'));?>

The link returns the site baseUrl so it appears like this

http://currentsitecom/http://www.newsite.com/about/

Can anyone suggest why this doesn't work?

Was it helpful?

Solution

The link shouldn't have / before http://

<?php echo CHtml::link(
    CHtml::image(Yii::app()->baseUrl.'/images/image.png'),
    array('http://www.newsite.com/about/')
);?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top