12345678910111213141516171819202122232425262728 |
- <?
- $topic_id = $model[0]->id;
- $news_query = \app\models\front\News::find()->leftJoin('story_relation t', 't.news_id = id')->andWhere(['t.topic_id'=>$topic_id])->limit(30);
- $newsDataProvider = new \yii\data\ActiveDataProvider(
- [
- "query"=>$news_query,
- "pagination" => false
- ]
- );
- $story = $newsDataProvider->getModels();
- $buf = '';
- foreach( $story as $a ){
- $buf .= "{ img: '/images/news/news/".$a['id']."_size2.jpg',";
- $buf .= " html: '<a href=\"/news/{$a['id']}/\"><div class=\"any\"><div class=\"text\"><span class=\"inverse header\">".trim(str_replace("'",'"',stripslashes($a['title'])))."</span><span class=\"inverse lid\">".trim(str_replace("'",'"',stripslashes($a['lid'])))."</span></div></div></a>'},";
- }
- // to do resize 1200 for longrid
- $c = Yii::$app->acache;
- $c->set('fotorama', true);
- ?>
- <div class="title_001">Читайте также в сюжете: <a href="/story/<?=$model[0]->url?>"><?=$model[0]->title;?></a></div>
- <center><div class="fotoramast" data-width="720" data-ratio="680/383" data-max-width="100%"></div></center>
- <script type="text/javascript">
- window.addEventListener("DOMContentLoaded",function () {
- $('.fotoramast').fotorama({ width:'100%',maxwidth:800,thumbheight:70,thumbwidth:94, click:false,nav: false, captions: true, caption: 'overlay', allowfullscreen:'native', <?=($story[0]->id == $id)?'startindex:1,':''?>data: [ <?=str_replace('\"','"',$buf)?> ] });
- });
- </script>
|