bambinou
(Benoitrivaux)
1
Hi All,
I would like to pass my array data into a url:
this is the array data:
array(‘dealPayments/buy’, ‘dealid’ => $model->id),
Which I would like to pass into a <a> so when someone clicks and image it gets send to the url set by the array data.
I tried this:
echo CHtml::link(
but it is unfortunately echoing the <a> tag inside my href, I only need the url with the arrway data at the end , how to do this please?
Thank you,
Ben
oligalma
(Marc Oliveras)
2
You can use createUrl or createAbsoluteUrl
Yii::app()->createAbsoluteUrl('controller/action', array('lang' => 'en'));
You can put a link on an image like this:
echo CHtml::link(CHtml::image(Yii::app()->baseUrl . '/images/myimage.gif'), array('controller/action'));
bambinou
(Benoitrivaux)
3
Thank you Moginn,
Is it the same for both Yii 1 and Yii 2 please?
Thank you,
Ben
oligalma
(Marc Oliveras)
4
bambinou
(Benoitrivaux)
5
Thank you so much!
The last link you gave me is a bit of a gold mine (: thats exactly what I was looking for!
Thanks,
Ben