Development

Changeset 1394

You must first sign up to be able to contribute.

Changeset 1394

Show
Ignore:
Timestamp:
06/05/06 18:49:11 (2 years ago)
Author:
francois
Message:

fixed a wrong custom file structure model

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/doc/book/content/file_structure.txt

    r1308 r1394  
    144144Even if it is highly recommended to keep the default tree structure, it is possible to modify it for specific needs, for instance in order to match the requirements of a client who already has its own tree structure and coding conventions. 
    145145 
    146 Every path to a key directory is determined by a parameter ending with `_dir`. These parameters are defined in the framework, in a file called `$pear_data_dir/symfony/config/constants.php`, used by every symfony project. To customize the tree structure of an application, you simply need to override these settings. For that, use the `config.php` file of the `apps/myapp/config/` directory - this file is parsed for each request just after loading the default configuration
     146Every path to a key directory is determined by a parameter ending with `_dir`. These parameters are defined in the framework, in a file called `$pear_data_dir/symfony/config/constants.php`, used by every symfony project. To customize the tree structure of an application, you simply need to override these settings. For that, use the `config.php` file located in the `apps/myapp/config/` directory (for an application-wide directory structure), or the `config/config.php` (for a project-wide structure)
    147147 
    148148You will probably have to copy the default configuration from the symfony directory if you need to modify it. Here is an extract of the default configuration: 
     
    203203      js/ 
    204204      uploads/ 
     205      index.php 
     206 
     207Change the `SF_ROOT_DIR` constant defined in the `index.php` (and the other front controllers) from: 
     208 
     209    [php] 
     210    define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/..')); 
     211 
     212to 
     213 
     214    [php] 
     215    define('SF_ROOT_DIR', realpath(dirname(__FILE__).'/../../cgi-bin')); 
    205216 
    206217Then add the following lines to your `config/config.php`: 
    207218 
    208219    [php] 
     220    $sf_root_dir = sfConfig::get('sf_root_dir');    
    209221    sfConfig::add(array( 
    210       // root directory names 
    211       'sf_exec_dir_name'    => $sf_exec_dir_name   = 'cgi-bin', 
    212       'sf_apps_dir_name'    => $sf_apps_dir_name   = 'apps', 
    213       'sf_bin_dir_name'     => $sf_bin_dir_name    = 'batch', 
    214       'sf_cache_dir_name'   => $sf_cache_dir_name  = 'cache', 
    215       'sf_config_dir_name'  => $sf_config_dir_name = 'config', 
    216       'sf_data_dir_name'    => $sf_data_dir_name   = 'data', 
    217       'sf_doc_dir_name'     => $sf_doc_dir_name    = 'doc', 
    218       'sf_lib_dir_name'     => $sf_lib_dir_name    = 'lib', 
    219       'sf_log_dir_name'     => $sf_log_dir_name    = 'log', 
    220       'sf_test_dir_name'    => $sf_test_dir_name   = 'test', 
    221       'sf_web_dir_name'     => $sf_web_dir_name    = 'public_html', 
    222       'sf_upload_dir_name'  => $sf_upload_dir_name = 'uploads', 
    223      
    224       // global directory structure 
    225       'sf_app_dir'        => $sf_app_dir = $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_apps_dir_name.DIRECTORY_SEPARATOR.$sf_app, 
    226       'sf_bin_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_bin_dir_name, 
    227       'sf_base_cache_dir' => $sf_base_cache_dir = $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_cache_dir_name.DIRECTORY_SEPARATOR.$sf_app, 
    228       'sf_cache_dir'      => $sf_cache_dir      = $sf_base_cache_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_environment, 
    229       'sf_config_dir'     => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_config_dir_name, 
    230       'sf_data_dir'       => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_data_dir_name, 
    231       'sf_lib_dir'        => $sf_lib_dir = $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_lib_dir_name, 
    232       'sf_log_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_log_dir_name, 
    233       'sf_test_dir'       => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.$sf_test_dir_name, 
    234       'sf_web_dir'        => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_web_dir_name, 
    235       'sf_upload_dir'     => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_web_dir_name.DIRECTORY_SEPARATOR.$sf_upload_dir_name, 
    236      
    237       // lib directory names 
    238       'sf_model_dir_name'      => $sf_model_dir_name      = 'model', 
    239       'sf_plugin_lib_dir_name' => $sf_plugin_lib_dir_name = 'plugins', 
    240      
    241       // lib directory structure 
    242       'sf_model_lib_dir'  => $sf_lib_dir.DIRECTORY_SEPARATOR.$sf_model_dir_name, 
    243       'sf_plugin_lib_dir' => $sf_lib_dir.DIRECTORY_SEPARATOR.$sf_plugin_lib_dir_name, 
    244      
    245       // data directory names 
    246       'sf_plugin_data_dir'  => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.'data'.DIRECTORY_SEPARATOR.'plugins', 
    247      
    248       // data directory structure 
    249       'sf_plugin_dir' => $sf_root_dir.DIRECTORY_SEPARATOR.$sf_exec_dir_name.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'plugins', 
    250      
    251       // SF_CACHE_DIR directory structure 
    252       'sf_template_cache_dir' => $sf_cache_dir.DIRECTORY_SEPARATOR.'template', 
    253       'sf_i18n_cache_dir'     => $sf_cache_dir.DIRECTORY_SEPARATOR.'i18n', 
    254       'sf_config_cache_dir'   => $sf_cache_dir.DIRECTORY_SEPARATOR.$sf_config_dir_name, 
    255       'sf_test_cache_dir'     => $sf_cache_dir.DIRECTORY_SEPARATOR.'test', 
    256       'sf_module_cache_dir'   => $sf_cache_dir.DIRECTORY_SEPARATOR.'modules', 
    257      
    258       // SF_APP_DIR sub-directories names 
    259       'sf_app_i18n_dir_name'     => $sf_app_i18n_dir_name     = 'i18n', 
    260       'sf_app_config_dir_name'   => $sf_app_config_dir_name   = 'config', 
    261       'sf_app_lib_dir_name'      => $sf_app_lib_dir_name      = 'lib', 
    262       'sf_app_module_dir_name'   => $sf_app_module_dir_name   = 'modules', 
    263       'sf_app_template_dir_name' => $sf_app_template_dir_name = 'templates', 
    264      
    265       // SF_APP_DIR directory structure 
    266       'sf_app_config_dir'   => $sf_app_dir.DIRECTORY_SEPARATOR.$sf_app_config_dir_name, 
    267       'sf_app_lib_dir'      => $sf_app_dir.DIRECTORY_SEPARATOR.$sf_app_lib_dir_name, 
    268       'sf_app_module_dir'   => $sf_app_dir.DIRECTORY_SEPARATOR.$sf_app_module_dir_name, 
    269       'sf_app_template_dir' => $sf_app_dir.DIRECTORY_SEPARATOR.$sf_app_template_dir_name, 
    270       'sf_app_i18n_dir'     => $sf_app_dir.DIRECTORY_SEPARATOR.$sf_app_i18n_dir_name, 
    271      
    272       // SF_APP_MODULE_DIR sub-directories names 
    273       'sf_app_module_action_dir_name'   => 'actions', 
    274       'sf_app_module_template_dir_name' => 'templates', 
    275       'sf_app_module_lib_dir_name'      => 'lib', 
    276       'sf_app_module_view_dir_name'     => 'views', 
    277       'sf_app_module_validate_dir_name' => 'validate', 
    278       'sf_app_module_config_dir_name'   => 'config', 
    279       'sf_app_module_i18n_dir_name'     => 'i18n', 
     222      'sf_web_dir_name' => $sf_web_dir_name    = 'public_html', 
     223      'sf_web_dir'      => $sf_root_dir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$sf_web_dir_name, 
     224      'sf_upload_dir'   => $sf_root_dir.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.$sf_web_dir_name.DIRECTORY_SEPARATOR.$sf_upload_dir_name,        
    280225    )); 
    281226