<section> <div class="block-header">我收藏的节点</div> <?php $follow = \common\models\Follow::findAll(['user_id' => Yii::$app->user->id, 'type' => 2]); ?> <?php foreach ($follow as $f) { ?> <article class="sidebar"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tbody><tr> <td width="24" valign="middle" align="center"> <a href="/node/<?php echo $f->node->enname; ?> "><img src="<?php echo $f->node->logo24; ?> " class="img-rounded"></a> </td> <td width="10"></td> <td width="auto" valign="middle"> <a href="/node/<?php echo $f->node->enname; ?> "><?php echo $f->node->name; ?> </a> </td> </tr>
public function actionTopic() { $this->title = '我关注的主题' . ' - ' . Yii::$app->name; $this->description = ''; if (Yii::$app->user->isGuest) { return $this->redirect('/account/login?next=/account/topic'); } $query = Topic::find()->where(['in', 'id', ArrayHelper::map(Follow::findAll(['user_id' => Yii::$app->user->id, 'type' => 3]), 'follow_id', 'follow_id')]); $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['pageSize'], 'totalCount' => $query->count()]); $model = $query->orderBy(['id' => SORT_DESC])->offset($pagination->offset)->limit($pagination->limit)->all(); return $this->render('topic', ['model' => $model, 'pagination' => $pagination]); }