PHP code example of contao-community-alliance / dc-general-data-provider-php-globals-config-file

1. Go to this page and download the library: Download contao-community-alliance/dc-general-data-provider-php-globals-config-file 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/ */

    

contao-community-alliance / dc-general-data-provider-php-globals-config-file example snippets


use ContaoCommunityAlliance\DcGeneral\DataProvider\PhpGlobalsConfigFileProvider;

$GLOBALS['TL_DCA']['my_dca'] = array
(
	'config' => array(
		'dataContainer' => 'General',
	),
	'dca_config'   => array
	(
		'data_provider' => array
		(
			'default' => array
			(
				'class' => 'ContaoCommunityAlliance\DcGeneral\DataProvider\PhpGlobalsConfigFileProvider',

				/**
				 * The source filename.
				 */
				'source' => 'path/to/the/config.php',

				/**
				 * The namespace definition (default=null, optional).
				 */
				'namespace' => 'my/dca',

				/**
				 * The property key name pattern (default="*", optional).
				 */
				'pattern' => 'my_*',

				/**
				 * Save mode (default="diff", optional)
				 */
				'mode' => PhpGlobalsConfigFileProvider::MODE_ALL,
			)
		),
	),
);



// updated at: Mon, 17 Mar 2014 17:56:24 +0100

$GLOBALS['my']['dca']['my_field1'] = 'value 1';
$GLOBALS['my']['dca']['my_field2'] = 'value 2';
$GLOBALS['my']['dca']['my_field3'] = 'value 3';