How to create many items with CHtml::link?
If i use array in the first tag, the link is text array.
<a href="#">
<img src=""/><img src="">
</a>
example
How to create many items with CHtml::link?
If i use array in the first tag, the link is text array.
<a href="#">
<img src=""/><img src="">
</a>
example
You can do it like this, for example:
$image1 = CHtml::image(Yii::app()->baseUrl.’/image1.png’);
$image2 = CHtml::image(Yii::app()->baseUrl.’/image2.png’);
echo CHtml::link($image1.$image2, array(‘controller/action’));
It’s doesn’t work.
I just tested and it does work! Whats wrong with it? You getting an error or something?
I have many attribute in link array, and the link is wrong.
$image1 = CHtml::image(Yii::app()->baseUrl.'/image1.png');
$image2 = CHtml::image(Yii::app()->baseUrl.'/image2.png');
echo CHtml::link($image1.$image2, array("class"=>"example",Yii::app()->baseUrl.'/example'));
check doc here http://www.yiiframework.com/doc/api/1.1/CHtml#link-detail
the CHtml::link format must match pattern
link(string $text, mixed $url='#', array $htmlOptions=array ( ))
change your code to
echo CHtml::link($image1.$image2,Yii::app()->baseUrl.'/example' , array("class"=>"example"));
Ohh, thx.