andatech / yii2-cms
Yii 2 CMS from Anda Tech
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 4
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- 2amigos/yii2-ckeditor-widget: ^2.0
- andatech/yii2-user: dev-master
- kartik-v/yii2-detail-view: *
- kartik-v/yii2-export: *
- kartik-v/yii2-grid: @dev
- kartik-v/yii2-mpdf: *
- kartik-v/yii2-widgets: *
- maxmirazh33/yii2-uploadable-cropable-image: *
- sunhater/kcfinder: dev-master
- wbraganca/yii2-nested-set-behavior: *
- wowkaster/yii2-serialize-attributes: dev-master
- yii2tech/ar-softdelete: *
- yiisoft/yii2: *
- yiisoft/yii2-bootstrap: *
This package is not auto-updated.
Last update: 2024-11-09 20:33:49 UTC
README
Yii 2 CMS from Anda Tech
Main config
... 'bootstrap' => [ 'log', 'web-admin', ], ... 'modules' => [ 'web-admin' => [ 'class' => 'anda\cms\Module', 'tablePrefix' => 'web_', 'uploadDir' => '@uploads/anda-cms', 'uploadUrl' => '/uploads/anda-cms' ] ], 'components' => [ ... 'andacms' => [ 'class' => 'anda\cms\components\API', ], ... ]
Sample Controller
public function actionIndex() { $model = Yii::$app->andacms->getChildModule('news'); $searchModel = $model->getSearchModel(); $dataProvider = $model->getDataProvider(); return $this->render('index',[ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, ]); } public function actionView($id) { $model = Yii::$app->andacms->getChildModule('news')->view($id); if (Yii::$app->request->isAjax){ return $this->renderAjax('view',[ 'model' => $model ]); } return $this->render('view',[ 'model' => $model ]); } public function actionFrontpage() { $render = Data::cache('frontpage'.ucfirst($this->id), 3600, function(){ $model = Yii::$app->andacms->getChildModule($this->id); $model->getSearchModel(); $dataProvider = $model->getDataProvider(); $dataProvider->pagination->pageSize=$this->frontpageLimitItems; return $this->renderPartial('frontpage',[ 'dataProvider' => $dataProvider ]); }); return $render; } public function actionCategory($id) { $categoryModel = Yii::$app->andacms->getChildModule('category')->get($id); $searchModel = Yii::$app->andacms->getChildModule($this->id)->getSearchModel(); $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams()); $dataProvider->query->andFilterWhere(['category_id' => $id]); return $this->render('category',[ 'dataProvider' => $dataProvider, 'searchModel' => $searchModel, 'categoryModel' => $categoryModel ]); }