/** * Возвращает файлы в директории * @param type $path * @return type */ public function ReturnFilesDir($path = "") { $path = $_SERVER["DOCUMENT_ROOT"] . $path; $List = array(); $tempDir = $this->ReturnDir($path); if (!empty($tempDir)) { while (($dir = readdir($tempDir)) !== FALSE) { if ($dir !== ".." && $dir !== ".") { $cuteExt = app::I()->CuteExtendFroString($dir); $List[$cuteExt] = is_file($path . "/" . $dir) ? $dir : ""; } } } return $List; }
<?php if (!empty($items)) { ?> <article class="article"> <?php foreach ($items as $index => $value) { ?> <div class="article_list"> <header><h1><?php echo $value["name"]; ?> </h1></header> <div> <img src="<?php echo app::I()->GetImageFromDir(Yii::getAlias('@assets') . "/images/article/{$value["id"]}/short_img"); ?> " alt="" title="" class="left" /> <?php echo $value["short_text"]; ?> </div> <div> <a href="<?php echo \yii\helpers\Url::toRoute(['article/detail', 'id' => $value['id']]); ?> ">Подробнее</a> </div> </div> <?php }
<header><h1><?php echo $item["name"]; ?> </h1></header> <article> <div> <img src="<?php echo app::I()->GetImageFromDir(Yii::getAlias('@assets') . "/images/article/{$item["id"]}/img"); ?> " alt="" title="" class="left" /> <?php echo $item["full_text"]; ?> </div> </article>