我刚刚开始在 yii 中摸索表面,并且有一段时间让任何图像滑块扩展工作。我参考了http://www.yiiframework.com/doc/guide/1.1/en/extension.use并相信我的问题与扩展的初始化有关,但不确定。我尝试使用的最新扩展是http://www.yiiframework.com/extension/s3slider/。
到目前为止,我已经下载了扩展,解压缩并放在 /protected/extensions 中。我有两个图像我试图在 /images 之间滑动。我已将建议的代码放在我的 /protected/views/layouts/main.php 中,并更新了 $images 数组,如下所示:
<?php
$this->widget('application.extensions.s3slider.S3Slider',
array(
'images' => array(
array('images/giveBack.png', 'Give Back'),
array('images/priceGuarantee.png', 'Price Guarantee'),
),
'width' => '420',
'height' => '300',
)
);?>
当我重新加载我的页面时,我收到以下错误:
PHP notice
Array to string conversion
/protected/extensions/s3slider/S3Slider.php(71)
59 $cssparams = array(
60 'name' => $this->name,
61 'width' => $this->width,
62 'height' => $this->height,
63 'opacity' => $this->opacity,
64 );
65 $clientScript->registerCssFile($baseUrl . '/s3Slider.css.php?data=' . urlencode(base64_encode(serialize($cssparams)))); //http_build_query($cssparams)
66
67 $clientScript->registerCoreScript('jquery');
68
69 $clientScript->registerScriptFile($baseUrl . '/s3Slider.js');
70
71 $js = "jQuery('#{$this->name}').s3Slider($options);";
72 $cs->registerScript('Yii.S3Slider' . $this->name, $js);
73 echo $this->makeImages();
74 }
75
76 }
77 ?>
我的堆栈跟踪表明:
/protected/views/layouts/main.php(60): CBaseController->widget("application.extensions.s3slider.S3Slider", array("images" => array(array("images/giveBack.png", "Give Back"), array("images/priceGuarantee.png", "Price Guarantee")), "width" => "420", "height" => "300"))
55 array('images/priceGuarantee.png', 'Price Guarantee'),
56 ),
57 'width' => '420',
58 'height' => '300',
59 )
60 );?>
61
62 <?php
63 $this->widget('zii.widgets.CBreadcrumbs', array(
64 'links'=>$this->breadcrumbs,
65 )); ?><!-- breadcrumbs -->
对此的任何指导将不胜感激!
谢谢你。