예제 #1
0
파일: NodeLink.php 프로젝트: boxcore/v2sex
 static function NodeLink($node)
 {
     if (!($NodeLink = Yii::$app->cache->get('NodeLink' . $node))) {
         $NodeLink = NodeLink::find()->where(['node_id' => $node])->asArray()->all();
         Yii::$app->cache->set('NodeLink' . $node, $NodeLink, 0);
     }
     return $NodeLink;
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = NodeLink::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'node_id' => $this->node_id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'content', $this->content]);
     return $dataProvider;
 }
예제 #3
0
<?php

$NodeLink = \common\models\NodeLink::NodeLink($node);
if (!empty($NodeLink)) {
    ?>
<section>
    <div class="block-content markdown-content">
        <?php 
    foreach ($NodeLink as $link) {
        ?>
        <?php 
        echo $link['content'];
        ?>
        <?php 
    }
    ?>
    </div>
</section>
<?php 
}
예제 #4
0
 /**
  * Finds the NodeLink model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return NodeLink the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = NodeLink::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }