How to pass array data in a url?
Posted 15 December 2014 - 02:08 PM
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:
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?
Posted 19 December 2014 - 09:49 PM
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'));
Posted 20 December 2014 - 09:26 AM
Is it the same for both Yii 1 and Yii 2 please?
In Yii 2 to create a link you should use Html::a
to create an image you should use Html::img
to create url you should use Url