PHP code example of andrewdanilov / yii2-context

1. Go to this page and download the library: Download andrewdanilov/yii2-context 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-context example snippets


<?= \andrewdanilov\context\adsense\Adsense::widget([
	'client' => 'ca-pub-1234567890123456',
	'slot' => 1234567890,
	'format' => 'auto', // optional, default is 'auto'
	'layout' => 'in-article', // optional
	'fullWidthResponsive' => true, // optional
]); 

return [
	// ...
	'container' => [
		'definitions' => [
			'andrewdanilov\context\adsense\Adsense' => [
				'client' => 'ca-pub-1234567890123456',
			],
		],
	],
	// ...
];

<?= \andrewdanilov\context\yandexpartner\YandexPartner::widget(['set' => 'set1']) 

return [
	// ...
	'container' => [
		'definitions' => [
			'andrewdanilov\context\yandexpartner\YandexPartner' => [
				'blocks' => [
					'set1' => ['R-A-222222-1', 'R-A-222222-2', 'R-A-222222-3'],
					'set2' => ['R-A-111111-2', 'R-A-111111-3'],
					'set3' => ['R-A-111111-1'],
				],
			],
		],
		'singletons' => [
			'YandexPartnerStore' => [
				'class' => 'andrewdanilov\context\yandexpartner\YandexPartnerStore'
			],
		],
	],
];