PHP code example of andrewdanilov / yii2-site-data
1. Go to this page and download the library: Download andrewdanilov/yii2-site-data library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
andrewdanilov / yii2-site-data example snippets
$config = [
// ...
'modules' => [
// ...
'sitedata' => [
'class' => 'andrewdanilov\sitedata\Module',
'access' => ['admin'], // access role for module controllers, optional, default is ['@']
'uploadBasePath' => '@frontend/web', // optional, default is '@frontend/web'
'uploadPath' => 'upload/sitedata', // optional, default is 'upload/sitedata'
],
],
];
$this->title = Yii::$app->siteData->get('seo_title', 'Default seo title');
$this->title = Yii::$app->siteData->set('seo_title', 'New seo title');
// list of links for managing values of each category all in one page
$categoryListUrl = Yii::$app->urlManager->createUrl(['/sitedata/manager']);
// manager of all values of category in one page
$categoryDataManagerUrl = Yii::$app->urlManager->createUrl(['/sitedata/manager/edit', 'category_id' => 123]);
// grid for adding/editing/removing data items
$dataGridUrl = Yii::$app->urlManager->createUrl(['/sitedata/data']);
// grid for adding/editing/removing data categories
$categoryGridUrl = Yii::$app->urlManager->createUrl(['/sitedata/category']);