私はPHPで巨大な構成配列を変えようとしていますが、それは次のようになります
$config['festival'] =
array
(
'title' => 'USF Tango Festival',
'tableLayout' => array
(
'registration' => array
(
array('firstName','text'),
array('lastName','text'),
array('phone','text'),
array('email','text'),
array('hearAboutFestival','text'),
array('danceAs','enum(\'Leader\', \'Follower\', \'Both\')'),
array('student','tinyint(1)')
),
'experience' => array
(
array('options','text'),
array('lunchMeat','enum(\'Ham\',\'Turkey\',\'Vegetarian\')'),
array('lunchBread','enum(\'White\',\'Wheat\')'),
array('dinnerPref','enum(\'Chicken\',\'Beef\',\'Vegetarian\')')
)
),
'pageLayout' => array
(
'registration' => array
(
'jqueryRules' =>
<<<EOT
'firstName': 'required',
'lastName': 'required',
'phone': {
required: true,
phoneUS: true
},
'email': {
required: true,
email: true
},
'danceAs': 'required',
'partner': 'required',
'partnerMatching': {
required: function() {
return $("input[name='partner']").val() == 0;
}
},
'partnerName': {
required: function() {
return $("input[name='partner']").val() == 1;
}
}
EOT
,
'inputs' => array
(
array
(
'type' => 'text',
'name' => 'firstName',
'fullName' => 'First Name',
'required' => true,
'separateDiv' => false
),
array
(
'type' => 'text',
'name' => 'lastName',
'fullName' => 'Last Name',
'required' => true,
'separateDiv' => false
),
array
(
'type' => 'text',
'name' => 'phone',
'fullName' => 'Phone number',
'required' => true,
'separateDiv' => false
),
array
(
'type' => 'text',
'name' => 'email',
'fullName' => 'Email address',
'required' => true,
'separateDiv' => false
),
array
(
'type' => 'text',
'name' => 'hearAboutFestival',
'separateDiv' => false,
'fullName' => 'How did you hear about the festival?',
'required' => false
),
array
(
'type' => 'select',
'name' => 'danceAs',
'fullName' => 'You dance as a...',
'required' => true,
'separateDiv' => false,
'options' => array(array('leader','Leader'),array('follower','Follower'),array('both','Both'))
),
array
(
'type' => 'checkbox',
'name' => 'student',
'value' => '1',
'separateDiv' => false,
'fullName' => 'I am a student',
'required' => false
)
)
)
と
'options' => array
(
'busMilonga' => array
(
'price' => 20,
'student' => false,
'name' => 'Tango on the Town Bus milonga',
'description' => 'A bus milonga!'
),
'thursdayMilonga' => array
(
'price' => 10,
'student' => false,
'name' => 'Thursday Kickoff Milonga',
'description' => 'The un-official kick off milonga!'
),
'saturdayPass' => array
(
'price' => 90,
'student' => true,
'name' => 'Saturday pass',
'description' => 'Includes all Saturday workshops and milongas'
),
'sundayPass' => array
(
'price' => 80,
'student' => true,
'name' => 'Sunday pass',
'description' => 'Includes all Sunday workshops, the jam session, and milonga'
),
'milongaPass' => array
(
'price' => 70,
'earlyBird' => 50, //array(50,60),
'student' => true,
'name' => 'Milonga Pass',
'description' => 'Includes entrance to all night milongas'
),
'dinnerPass' => array
(
'price' => 20,
'student' => false,
'name' => 'Dinner pass',
'description' => 'Includes Saturday dinner'
),
'lunchPass' => array
(
'price' => 10,
'student' => false,
'name' => 'Saturday lunch',
'description' => 'Includes lunch on Saturday'
)
),
'info' => array
(
'instructors' => array('Instructors'),
'hour' => array('10','11','12','01','02','03'),
'min' => array('15','30','45','00'),
'tod' => array('AM','PM'),
'day' => array('Friday','Saturday','Sunday'),
'level' => array('Beginner','Intermediate','Advanced'),
'place' => array('REC 107','REC 033','REC 005'),
'sessions' => array
(
3, // days
array
(
'Friday', // day name
3, // sessions on this day
array
(
3, // workshops in session
'1100AM' // time
),
array
(
3,
'0100PM'
),
array
(
1,
'0230PM'
) // 1,4
),
array('Saturday', // 2,0
3, // 2,1
array(1,'1030AM'), //2,2
array(3,'1145AM'), // 2,3
array(3,'0145PM') // 2,4
),
array
(
'Sunday', // 3,0
3, // 3,1
array(1,'1115AM'), // 3,2
array(3,'1230PM'), // 3,3
array(3,'0230PM') // 3,4
)
)
)
データベースに。config.event.festival のようなタイトルのいくつかのテーブルを作成できると考えていますが、配列の下の各配列のテーブルを作成する必要があるため、面倒になります...
JSONエンコーディングやシリアライズの使用を避けたいので、データをすべてリレーショナルできれいに保ちますが、データベースではなく1つの大きな構成ファイルを保持する以外の方法はわかりません.