public function run() { $this->registerAssets(); $items = ['<a href="' . $this->home['url'] . '" class="btn btn-default">' . $this->home['name'] . '</a>', '<div class="btn btn-default">...</div>']; foreach ($this->items as $item) { if (is_array($item)) { $url = $item['url']; $name = $item['label']; } else { $url = 'javascript:void();'; $name = $item; } $items[] = Html::a(Html::tag('div', $name), Url::to($url), ['class' => 'btn btn-default']); } $items = join('', $items); return Html::tag('div', $items, ['class' => 'btn-group btn-breadcrumb']); }
public static function articleItem($row, $category) { if (!is_array($row)) { $id = $row; $item = \app\models\Article::find($id); if (is_null($item)) { return ''; } $row = $item->getFields(); } // Заголовок $html[] = Html::tag('div', Html::tag('h4', $row['header']), ['class' => 'header']); // ссылка $item2 = ['id' => $row['id_string'], 'year' => substr($row['date_insert'], 0, 4), 'month' => substr($row['date_insert'], 5, 2), 'day' => substr($row['date_insert'], 8, 2), 'category' => $category]; $link = "/category/{$item2['category']}/article/{$item2['year']}/{$item2['month']}/{$item2['day']}/{$item2['id']}"; // картинка с ссылкой $html[] = Html::tag('p', Html::a(Html::img($row['image'], ['width' => '100%', 'class' => 'thumbnail']), $link)); // Описание $content = $row['description']; if ($content . '' == '') { $content = self::getMiniText($row['content']); } else { $content = self::getMiniText($content); } $html[] = Html::tag('p', $content); return Html::tag('div', join('', $html), ['class' => 'col-lg-4 articleItem']); }