Posted By

antpaw on 09/22/09


Tagged

php 3 kohana


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

JSawo


Kohana 3 bootstrap.php for admin subfolder


 / Published in: PHP
 

  1. <?php defined('SYSPATH') or die('No direct script access.');
  2.  
  3. //-- Environment setup --------------------------------------------------------
  4.  
  5. /**
  6.  * Set the default time zone.
  7.  *
  8.  * @see http://docs.kohanaphp.com/features/localization#time
  9.  * @see http://php.net/timezones
  10.  */
  11. date_default_timezone_set('America/Chicago');
  12.  
  13. /**
  14.  * Enable the Kohana auto-loader.
  15.  *
  16.  * @see http://docs.kohanaphp.com/features/autoloading
  17.  * @see http://php.net/spl_autoload_register
  18.  */
  19. spl_autoload_register(array('Kohana', 'auto_load'));
  20.  
  21. //-- Configuration and initialization -----------------------------------------
  22.  
  23. /**
  24.  * Initialize Kohana, setting the default options.
  25.  *
  26.  * The following options are available:
  27.  *
  28.  * - string base_url path, and optionally domain, of your application NULL
  29.  * - string index_file name of your index file, usually "index.php" index.php
  30.  * - string charset internal character set used for input and output utf-8
  31.  * - string cache_dir set the internal cache directory APPPATH/cache
  32.  * - boolean errors enable or disable error handling TRUE
  33.  * - boolean profile enable or disable internal profiling TRUE
  34.  * - boolean caching enable or disable internal caching FALSE
  35.  */
  36. Kohana::init(array('base_url' => '/', 'index_file' => ''));
  37.  
  38. /**
  39.  * Attach the file write to logging. Multiple writers are supported.
  40.  */
  41. Kohana::$log->attach(new Kohana_Log_File(APPPATH.'logs'));
  42.  
  43. /**
  44.  * Attach a file reader to config. Multiple readers are supported.
  45.  */
  46. Kohana::$config->attach(new Kohana_Config_File);
  47.  
  48. /**
  49.  * Enable modules. Modules are referenced by a relative or absolute path.
  50.  */
  51. Kohana::modules(array(
  52. // 'auth' => MODPATH.'auth', // Basic authentication
  53. // 'codebench' => MODPATH.'codebench', // Benchmarking tool
  54. // 'database' => MODPATH.'database', // Database access
  55. // 'image' => MODPATH.'image', // Image manipulation
  56. // 'orm' => MODPATH.'orm', // Object Relationship Mapping
  57. // 'pagination' => MODPATH.'pagination', // Paging of results
  58. 'userguide' => MODPATH.'userguide', // User guide and API documentation
  59. ));
  60.  
  61. /**
  62.  * Set the routes. Each route must have a minimum of a name, a URI and a set of
  63.  * defaults for the URI.
  64.  */
  65.  
  66. Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))')
  67. ->defaults(array(
  68. 'directory' => 'admin',
  69. 'controller' => 'asdf',
  70. 'action' => 'blub',
  71. ));
  72.  
  73. Route::set('default', '(<controller>(/<action>(/<id>)))')
  74. ->defaults(array(
  75. 'controller' => 'welcome',
  76.  
  77. ));
  78. /**
  79.  * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
  80.  * If no source is specified, the URI will be automatically detected.
  81.  */
  82. echo Request::instance()
  83. ->execute()
  84. ->send_headers()
  85. ->response;

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Paulson357 on August 16, 2018

The bootstrap is responsible for the flow of your application. In previous versions of Kohana the bootstrap was in system and was somewhat of an unseen, uneditible force. krogerfeedback.com

You need to login to post a comment.