[php] link generation

Viewer

copydownloadembedprintName: link generation
  1. //my view file code
  2. DetailView::widget([
  3.         'model' => $model,
  4.         'attributes' => [
  5.             'name',
  6.             'project_date:date',
  7.             'client_name',
  8.             'project_url:url',
  9.             'detail:html',
  10.             [
  11.                 'label' => 'Project Images',
  12.                 'format' => ['raw'], 
  13.                 'value' =>  $this->render('_test', ['listData' => $model])
  14.             ]
  15.         ],
  16.     ])
  17.     
  18.     // my _test.php file code
  19.     $link = Yii::getAlias('@frontend/web/projects_pictures/'.$listData->id);
  20.     $path = \yii\helpers\FileHelper::findFiles($link);
  21.     foreach ($path as $pic){
  22.         echo "<img src='$pic' alt='test' />";
  23.     }

Editor

You can edit this paste and save as new:


File Description
  • link generation
  • Paste Code
  • 23 Jan-2022
  • 705 Bytes
You can Share it: