Tuesday 29 October 2019

twitter bootstrap - Yii Widget, unexpected ), where is the error?




  $this->widget('bootstrap.widgets.TbAlert', array(
'block'=>true, // display a larger alert block?
'fade'=>true, // use transitions?
'closeText'=>'×', // close link text - if set to false, no close link is displayed
'alerts'=>array( // configurations per alert type
'success'=>array(
'block'=>true,
'fade'=>true,
'closeText'=>'×',

), // success, info, warning, error or danger
),
),
);
?>


PHP Parse error: syntax error, unexpected ')' in /dev/shm/untitled.php on line 14



I really can't find the error and watched it like 100 times. Need to implement this widget,

thanks!



There are 4 opening parenthesis and 4 closing. Commas are ok, so... ?


Answer



  $this->widget('bootstrap.widgets.TbAlert', array(
'block'=>true,
'fade'=>true,
'closeText'=>'×',
'alerts'=>array(

'success'=>array(
'block'=>true,
'fade'=>true,
'closeText'=>'×'
),
),
), // you have comma here - it's mistake
);
?>


No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...