示例#1
0
 public function run()
 {
     $uploadPath = Yii::getAlias('@backend') . '/web/upload';
     $model = Ad::findOne(['short_code' => $this->short_code]);
     if ($model && is_file($uploadPath . '/' . $model->pic_url)) {
         list($width, $height, $type, $attr) = getimagesize($uploadPath . '/' . $model->pic_url);
         if ($this->height && $this->width) {
             //nothing
         } elseif ($this->height) {
             $this->width = floor($this->height * $width / $height);
         } elseif ($this->width) {
             $this->height = floor($this->width * $height / $width);
         }
         $img = General::showImg($model->pic_url, 'c', $model->title, 'px', $this->width, $this->height);
         return $this->render('side-ad', ['model' => $model, 'img' => $img]);
     } else {
         return '';
     }
 }
示例#2
0
文件: _item.php 项目: jorry2008/turen
?>

<?php 
//$model, $key, $index, $widget
//Html::encode($model->title)
$length = 28;
//标题截取长度
$dlength = 82;
?>

<div class="list">
	<?php 
//这里可以考虑从content中获取图片
?>
    <?php 
echo Html::a(General::showImg($model->pic_url, 'c', $model->title, 'px', 140, 102), ['/site/post/view', 'id' => $model->id], ['class' => 'img', 'title' => $model->title]);
?>
    <div class="list_detail">
    	<?php 
$options = ['style' => ''];
if (!empty($model->colorval) || !empty($model->boldval)) {
    Html::addCssStyle($options, ['color' => $model->colorval, 'font-weight' => $model->boldval]);
}
?>
    	<?php 
echo Html::a(StringHelper::truncate($model->title, $length), ['/site/post/view', 'id' => $model->id], ['class' => 'title', 'title' => $model->title, 'style' => $options['style']]);
?>
        
        <div class="cont">
        	<?php 
if (empty($model->description)) {
示例#3
0
文件: index.php 项目: jorry2008/turen
	    <a href="javascript:void(0)" class="prev"></a>
	    <a href="javascript:void(0)" class="next"></a>
        <ul>
        	<?php 
foreach ($scenes as $scene) {
    ?>
            <li>
            	<?php 
    $link = $scene->link_url;
    if (empty($link)) {
        $link = ['/site/pic/view', 'name' => '', 'id' => $scene->id];
    }
    ?>
            	<?php 
    echo Html::a('<span class="pic_box">' . General::showImg($scene->pic_url, 'o', $scene->title, 'px', '230', '140') . '</span><span class="text-box">' . $scene->title . '</span>', $link);
    ?>
            </li>
            <?php 
}
?>
        </ul>
    </div>
</div>

<div id="index_banner_botton">
	<?php 
echo Html::a(General::showImg($adBottom->pic_url, 'o', $adBottom->title, 'px', '1024', '95', 'w'), ['/ad/link/ad-click', 'name' => $adBottom->short_code], ['target' => '_blank']);
?>
</div>