bambinou
(Benoitrivaux)
December 15, 2014, 7:37pm
1
Hello,
Could someone help me correcting this url please?
<?php CHtml::link(CHtml::image(Yii::app()->request->baseUrl.’/images/current_price.png’ onmouseover=“this.src=’../images/current_price2.png’” onmouseout=“this.src=’../images/current_price.png’”), array(‘dealPayments/buy’, ‘dealid’ => $model->id), array(‘onClick’ => ‘if(confirm(“Are you sure you want to do this?”)) return true;else return false;’, ‘id’ => ‘buybutton’)) ?>
This is giving me the error:
Parse error: syntax error, unexpected ‘onmouseover’ (T_STRING) xxxxx/view.php on line 246
Thank you!
Ben
oligalma
(Marc Oliveras)
December 15, 2014, 10:45pm
2
the CHtml::image sintax is this:
[b]
CHtml::image(string $src, string $alt=’’, array $htmlOptions=array ())
$src string the image URL
$alt string the alternative text display
$htmlOptions array additional HTML attributes (see tag).[/b]
You should place onmouseover and onmouseout inside an array
bambinou
(Benoitrivaux)
December 15, 2014, 10:53pm
3
Thank you for your help,
I will have to give it a shot tomorrow but I am not too sure about the writing… will post back here if I struggle.
Thanks,
Ben
moginn:
the CHtml::image sintax is this:
[b]
CHtml::image(string $src, string $alt=’’, array $htmlOptions=array ())
$src string the image URL
$alt string the alternative text display
$htmlOptions array additional HTML attributes (see tag).[/b]
You should place onmouseover and onmouseout inside an array
negar
(Nar8591)
December 16, 2014, 5:09am
4
hi
use this code
$x = CHtml::image(Yii::app()->request->baseUrl.'/images/logo.png' ,'gh',array('onmouseover'=>"this.src='../images/current_price2.png'" ,'onmouseout'=>"this.src='../images/current_price.png'"));
echo CHtml::link($x, array('seller/report/index', 'dealid' => 12), array('onClick' => 'if(confirm("Are you sure you want to do this?")) return true;else return false;', 'id' => 'buybutton'));
bambinou
(Benoitrivaux)
December 16, 2014, 5:39pm
5
Thanks I will try and let you know. I would not have worked that one out to be honest…
Will post back soon. Thanks again
bambinou
(Benoitrivaux)
December 16, 2014, 6:50pm
6
Thank you so much!!!
It worked, I changed a few things but very minor!
Did you write this code right out of the box??? I could not get any help in the chat room with this.
One little thing I would like to understand please, is why did you create the $X variable and pass it inside the Chtml::link, there was no other way in doing this like having the whole code into multiple array inside the Chtml::link ?
Thanks again!!!
Ben