Development

Changeset 9917

You must first sign up to be able to contribute.

Changeset 9917

Show
Ignore:
Timestamp:
06/27/08 11:28:06 (4 months ago)
Author:
FabianLange
Message:

doc: added example on how to realize first level arrays in symfony configuration files. closes #3121

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.0/book/05-Configuring-Symfony.txt

    r4907 r9917  
    142142        webmaster:  webmaster@example.com 
    143143 
    144 In this example, `mail` is a key and `general` is only a category header. Everything works as if the category header didn't exist, as shown in Listing 5-10. The `tax` parameter is actually a direct child of the `all` key. 
     144In this example, `mail` is a key and `general` is only a category header. Everything works as if the category header didn't exist, as shown in Listing 5-10. The `tax` parameter is actually a direct child of the `all` key. However using categories helps symfony dealing with arrays that are beneath the `all` key. 
    145145 
    146146Listing 5-10 - Category Headers Are Only There for Readability and Are Actually Ignored 
     
    497497 
    498498    all: 
    499       version:        1.5 
    500499      .general: 
    501500        tax:          19.6 
     
    513512 
    514513    [php] 
    515     echo sfConfig::get('app_version'); 
    516      => '1.5' 
    517514    echo sfConfig::get('app_tax');   // Remember that category headers are ignored 
    518515     => '19.6' 
     
    569566    [php] 
    570567    sfConfig::get('app_creditcards_fake'); 
     568 
     569>**NOTE** 
     570>When you should require an PHP array directly beneath the `all` key you need to use a category header, otherwise symfony will make the values separately available as shown above. 
     571> 
     572>     all: 
     573>       .array: 
     574>         creditcards: 
     575>           fake:             off 
     576>           visa:             on 
     577>           americanexpress:  on 
     578> 
     579>     [php] 
     580>     print_r(sfConfig::get('app_creditcards')); 
     581> 
     582>     Array( 
     583>       [fake] => false 
     584>       [visa] => true 
     585>       [americanexpress] => true 
     586>     ) 
    571587 
    572588>**TIP** 
  • doc/branches/1.1/book/05-Configuring-Symfony.txt

    r9782 r9917  
    142142        webmaster:  webmaster@example.com 
    143143 
    144 In this example, `mail` is a key and `general` is only a category header. Everything works as if the category header didn't exist, as shown in Listing 5-10. The `tax` parameter is actually a direct child of the `all` key. 
     144In this example, `mail` is a key and `general` is only a category header. Everything works as if the category header didn't exist, as shown in Listing 5-10. The `tax` parameter is actually a direct child of the `all` key. However using categories helps symfony dealing with arrays that are beneath the `all` key. 
    145145 
    146146Listing 5-10 - Category Headers Are Only There for Readability and Are Actually Ignored 
     
    461461 
    462462    all: 
    463       version:        1.5 
    464463      .general: 
    465464        tax:          19.6 
     
    477476 
    478477    [php] 
    479     echo sfConfig::get('app_version'); 
    480      => '1.5' 
    481478    echo sfConfig::get('app_tax');   // Remember that category headers are ignored 
    482479     => '19.6' 
     
    533530    [php] 
    534531    sfConfig::get('app_creditcards_fake'); 
     532 
     533>**NOTE** 
     534>When you should require an PHP array directly beneath the `all` key you need to use a category header, otherwise symfony will make the values separately available as shown above. 
     535> 
     536>     all: 
     537>       .array: 
     538>         creditcards: 
     539>           fake:             off 
     540>           visa:             on 
     541>           americanexpress:  on 
     542> 
     543>     [php] 
     544>     print_r(sfConfig::get('app_creditcards')); 
     545> 
     546>     Array( 
     547>       [fake] => false 
     548>       [visa] => true 
     549>       [americanexpress] => true 
     550>     ) 
    535551 
    536552>**TIP**