예제 #1
0
 public function actionIndex()
 {
     $keywords = Yii::app()->request->getParam('keywords');
     $sql = "select * from {{usertags}} where tagname like'%{$keywords}%' order by create_time desc";
     //采用模糊查询方法查询符合条件的数据
     $tag = Usertags::model()->findAllBySql($sql);
     $data = array('tag' => $tag, 'id' => $keywords);
     $this->render('index', $data);
 }
예제 #2
0
 public function actionDelete($id)
 {
     $model = Usertags::model()->findByPk($id);
     if ($model->delete()) {
         //添加成功时候的提示信息设置
         /**
          *setFlash getFlash hasFlash 几个方法
          */
         Yii::app()->user->setFlash('shanchu', '您的标签删除成功');
     }
     $this->redirect('./index.php?r=usertags/usertags');
 }
예제 #3
0
파일: index.php 프로젝트: SallyU/footprints
    $gznu = "select * from {{follow}} where uid={$shui}";
    $numGZ = count(Follow::model()->findAllBySql($gznu));
    echo $numGZ;
    ?>
</b>人,粉丝<b><?php 
    $byshui = $_t->uid;
    $fansnu = "select * from {{follow}} where touid={$byshui}";
    $numFAN = count(Follow::model()->findAllBySql($fansnu));
    echo $numFAN;
    ?>
</b>人</p>

	                            <p class="tagsList" style="padding-top:5px;">
	                            <?php 
    $sqlbq = "select * from {{usertags}} where uid={$_t->uid}";
    $bqian = Usertags::model()->findAllBySql($sqlbq);
    foreach ($bqian as $bq) {
        ?>
	                                	<a href="<?php 
        echo Yii::app()->createUrl('search/index', array('keywords' => $bq->tagname));
        ?>
" class=""><?php 
        echo $bq->tagname;
        ?>
</a>
	                            <?php 
    }
    ?>

	                    </li>
	                </ul>
예제 #4
0
 public function actionHome($uid)
 {
     if (Yii::app()->user->isGuest) {
         $this->redirect('./index.php?r=user/login');
     }
     $vhid = $uid;
     $user = User::model()->findByPk($uid);
     $user->visitor += 1;
     $user->save(false);
     if ($uid != Yii::app()->user->id) {
         $visit = new Visitor();
         $visit->uid = Yii::app()->user->id;
         $visit->toid = $uid;
         $visit->time = time();
         $visit->save(false);
     }
     //活跃用户展示
     $yaya = User::model()->findAll(array('order' => 'update_time desc', 'limit' => 16));
     //思想展示
     $sql = "select * from {{article}} where author_id = {$uid} order by create_time desc limit 0, 20 ";
     $sixiang = Article::model()->findAllBySql($sql);
     //标签展示
     $sq = "select * from {{usertags}} where uid = {$uid} order by create_time desc";
     $bq = Usertags::model()->findAllBySql($sq);
     //home页面用户关注的丫丫数量
     $uf = "select * from {{follow}} where uid={$uid}";
     $userfollow = count(Follow::model()->findAllBySql($uf));
     //home页面粉丝数量
     $fan = "select * from {{follow}} where touid={$uid}";
     $fans = count(Follow::model()->findAllBySql($fan));
     //访问我的主页的用户展示
     $userid = Yii::app()->user->id;
     $cs1 = "select *,count(distinct uid) from {{visitor}} where toid={$userid} group by uid order by time desc limit 16";
     $fangwenwo = Visitor::model()->findAllBySql($cs1);
     $cs2 = "select *,count(distinct toid) from {{visitor}} where uid={$vhid} group by toid order by time desc limit 16";
     $visitwho = Visitor::model()->findAllBySql($cs2);
     $data = array('user' => $user, 'yaya' => $yaya, 'sixiang' => $sixiang, 'bq' => $bq, 'userfollow' => $userfollow, 'fans' => $fans, 'fangwenwo' => $fangwenwo, 'visitwho' => $visitwho);
     $this->render('home', $data);
 }
예제 #5
0
" href="<?php 
            echo Yii::app()->createUrl('user/home', array('uid' => $_s->uid));
            ?>
"><?php 
            echo $_s->usertag->nickname;
            ?>
</a><br>[<?php 
            echo $_s->tagname;
            ?>
]<br>
								<a href="<?php 
            echo Yii::app()->createUrl('search/index', array('keywords' => $_s->tagname));
            ?>
"><span class="tag"><?php 
            $sql = "select * from {{usertags}} where tagname='{$name}' order by create_time desc";
            $sa = Usertags::model()->findAllBySql($sql);
            echo $c = count($sa);
            ?>
位同道中人<span class="ffsong">&gt;&gt;</span></span></a>
							</div>
						</li>
                        <?php 
        }
        ?>
                    <?php 
    }
    ?>
                    <?php 
}
?>
					</ul>