i use CHtml::link() generate a link for mail,but it’s a relative url,in mail it’s like /index.php?r=test/test&id=1
but i need http://www.domain.com/index.php?r=test/test&id=1
can CHtml::link() generate a absolute url?
i use CHtml::link() generate a link for mail,but it’s a relative url,in mail it’s like /index.php?r=test/test&id=1
but i need http://www.domain.com/index.php?r=test/test&id=1
can CHtml::link() generate a absolute url?
Try this:
echo CHtml::link('read more', $this->createAbsoluteUrl('test/test',array('id'=>$id)));
I had the same issue, so I used a base tag and then set relative urls.
<head>
<?php echo '<base href="'.$this->createAbsoluteUrl('/').'/" />'; ?>
</head>
...
<?php echo CHtml::link('Contact Us', 'site/contact');?>
<?php echo CHtml::link(‘Link Text’,array(‘controller/action’,
'param1'=>'value1')); ?>
CHtml::link(‘Back’,Yii::app()->request->urlReferrer);
CHtml::link(‘Home’, $this->createAbsoluteUrl(’/’));
Also you can use CController
like
CHtml::link('Home', CController::CreateUrl('//gallery/mail?action=index'));