main.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // uncomment the following to define a path alias
  3. // Yii::setPathOfAlias('local','path/to/local-folder');
  4. // This is the main Web application configuration. Any writable
  5. // CWebApplication properties can be configured here.
  6. return array(
  7. 'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
  8. 'name'=>'Yii Blog Demo',
  9. // preloading 'log' component
  10. 'preload'=>array('log'),
  11. // autoloading model and component classes
  12. 'import'=>array(
  13. 'application.models.*',
  14. 'application.components.*',
  15. ),
  16. 'defaultController'=>'post',
  17. // application components
  18. 'components'=>array(
  19. 'user'=>array(
  20. // enable cookie-based authentication
  21. 'allowAutoLogin'=>true,
  22. ),
  23. 'db'=>array(
  24. 'connectionString' => 'sqlite:protected/data/blog.db',
  25. 'tablePrefix' => 'tbl_',
  26. ),
  27. // uncomment the following to use a MySQL database
  28. /*
  29. 'db'=>array(
  30. 'connectionString' => 'mysql:host=localhost;dbname=blog',
  31. 'emulatePrepare' => true,
  32. 'username' => 'root',
  33. 'password' => '',
  34. 'charset' => 'utf8',
  35. 'tablePrefix' => 'tbl_',
  36. ),
  37. */
  38. 'errorHandler'=>array(
  39. // use 'site/error' action to display errors
  40. 'errorAction'=>'site/error',
  41. ),
  42. 'urlManager'=>array(
  43. 'urlFormat'=>'path',
  44. 'rules'=>array(
  45. 'post/<id:\d+>/<title:.*?>'=>'post/view',
  46. 'posts/<tag:.*?>'=>'post/index',
  47. '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
  48. ),
  49. ),
  50. 'log'=>array(
  51. 'class'=>'CLogRouter',
  52. 'routes'=>array(
  53. array(
  54. 'class'=>'CFileLogRoute',
  55. 'levels'=>'error, warning',
  56. ),
  57. // uncomment the following to show log messages on web pages
  58. /*
  59. array(
  60. 'class'=>'CWebLogRoute',
  61. ),
  62. */
  63. ),
  64. ),
  65. ),
  66. // application-level parameters that can be accessed
  67. // using Yii::app()->params['paramName']
  68. 'params'=>require(dirname(__FILE__).'/params.php'),
  69. );