Php 如何在一个页面中使用同一小部件两次

Php 如何在一个页面中使用同一小部件两次,php,yii2,Php,Yii2,我正在使用fotorama小部件,我想创建一个比较页面 我划分页面并使用2个小部件来比较图像 我已尝试修改源代码,但仍然不起作用 这是源代码 <div class="row"> <div class="col-sm-6"> <center> <?php $fotorama = Fotorama::begin( [ 'options' => [ 'height' => '540px',

我正在使用fotorama小部件,我想创建一个比较页面

我划分页面并使用2个小部件来比较图像

我已尝试修改源代码,但仍然不起作用

这是源代码

<div class="row">
<div class="col-sm-6">
<center>
 <?php 
$fotorama = Fotorama::begin(
    [
        'options' => [
            'height' => '540px',
            'width' => '720px',
            'loop' => true,
            'hash' => true,
            'ratio' => 800/600,
            'transition' => 'dissolve',
            'arrows' => true,
            'nav' => 'thumbs',
            'navposition' => 'bottom',
            'thumbwidth' => 50, // Number. Tumbnail width in pixels.
            'thumbheight' => 50, 
        ],
        'spinner' => [
            'lines' => 20,
        ],
        'tagName' => 'span',
        'useHtmlData' => false,
        'htmlOptions' => [
            'class' => 'custom-class',
            'id' => 'custom-id',
        ],
    ]
);
$id = Yii::$app->request->queryParams['id'];
switch ($id) {
     case '1':
         $folder = "gsmap7";
         break;
     case '2':
         $folder = "ismidx";
         break;     

     default:
         # code...
         break;
 } 

foreach ($dataProvider as $model ) {
    echo "<img src=\"../img/{$folder}/{$model->NAMA_FILE}\" > ";
}   

$fotorama->end(); ?>
</center>
</div><div class="col-sm-6">
<center>
 <?php 
$fotorama2 = Fotorama::begin(
    [
        'options' => [
            'height' => '540px',
            'width' => '720px',
            'loop' => true,
            'hash' => true,
            'ratio' => 800/600,
            'transition' => 'dissolve',
            'arrows' => false,
            'nav' => 'thumbs',
            'navposition' => 'bottom',
            'thumbwidth' => 50, // Number. Tumbnail width in pixels.
            'thumbheight' => 50, 
        ],
        'spinner' => [
            'lines' => 20,
        ],
        'tagName' => 'span',
        'useHtmlData' => false,
        'htmlOptions' => [
            'class' => 'custom-class',
            'id' => 'custom-id',
        ],
    ]
);

switch ($id) {
     case '1':
         $folder = "ismidx";
         break;
     case '2':
         $folder = "";
         break;     

     default:
         # code...
         break;
 } 

foreach ($dataProvider_compare as $model ) {
    echo "<img src=\"../img/{$folder}/{$model->NAMA_FILE}\" > ";
}   

$fotorama2->end(); ?>
</center>
</div>
</div>

事情就是这样

是否可以在一个页面上使用相同的小部件? 或者你能告诉我酷的小部件正在显示图像缩略图和导航下一步,上一步,和播放?它就像windows中的图像查看器一样,只需为每个小部件使用不同的浏览器即可。根据上面的代码,它们都已设置为

'id' => 'custom-id',

请注意,如果不显式设置id,它将是。

如何设置?在哪里可以找到id=>“cutom id”?