I have to disagree on your alternative way being easier to read: it looks like it take 3 times as many lines of code to do the same thing.
I think if you do these two things, the default way is just fine:
-
Use the tab character for indenting, and keep things properly indented at all times.
-
Use a good code editor so that when you put your text cursor (the blinking line, whatever you call it) next to a bracket, it highlights the corresponding bracket. This helps find errors in where your brackets/parentheses begin and end. Most of the high-end code editors support this.
<?php
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Razmer Car Parts',
'timezone'=>'UTC',
'preload'=>array('log'),
'import'=>array(
'application.models.*',
'application.models.shared.*',
'application.models.shared.image.*',
'application.components.shared.*',
'application.components.*',
'application.components.shared.imageGallery.*',
'ext.mail.Message',
'application.components.flash.Flash',
),
'components'=>array(
'loader' => array(
'class' => 'application.components.shared.Loader'
),
'mail' => array(
'class' => 'application.extensions.mail.Mail',
'debug'=>false,
),
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'rules'=>array(
'category/<id>'=>'category/list',
),
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning, info, watch',
'categories'=>'system.*',
),
array(
'class'=>'CFileLogRoute',
'levels'=>'info',
'categories'=>'image.thumbGeneration',
'logFile'=>'image.log'
),
array(
'class'=>'CFileLogRoute',
'levels'=>'info',
'categories'=>'image.noThumbGeneration',
'logFile'=>'imageX.log'
),
),
),
'user'=>array(
'class'=>'WebUser',
'allowAutoLogin'=>true,
),
'db'=>array(
'enableParamLogging'=>true,
'schemaCachingDuration'=>YII_DEBUG ? 0 : 3600,
),
),
'params'=>array(
'adminEmail'=>'a@a.com',
'infolinks'=>array(
'About us'=>array('site/about'),
'Contact us'=>array('site/contact'),
'Privacy Policy'=>array('site/policy'),
'Terms & Conditions'=>array('site/terms'),
),
),
);