Development

Changeset 4935

You must first sign up to be able to contribute.

Changeset 4935

Show
Ignore:
Timestamp:
08/30/07 10:25:26 (3 years ago)
Author:
fabien
Message:

doc: updated flash attributes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/trunk/book/06-Inside-the-Controller-Layer.txt

    r4908 r4935  
    576576 
    577577    [php] 
    578     $this->setFlash('attrib', $value); 
     578    $this->getUser()->setFlash('notice', $value); 
    579579 
    580580The template will be rendered and delivered to the user, who will then make a new request to another action. In this second action, just get the value of the flash attribute like this: 
    581581 
    582582    [php] 
    583     $value = $this->getFlash('attrib'); 
    584  
    585 Then forget about it. After delivering this second page, the `attrib` flash attribute will be flushed. And even if you don't require it during this second action, the flash will disappear from the session anyway. 
    586  
    587 If you need to access a flash attribute from a template, use the `$sf_flash` object: 
    588  
    589     [php] 
    590     <?php if ($sf_flash->has('attrib')): ?> 
    591       <?php echo $sf_flash->get('attrib') ?> 
     583    $value = $this->getUser()->getFlash('notice'); 
     584 
     585Then forget about it. After delivering this second page, the `notice` flash attribute will be flushed. And even if you don't require it during this second action, the flash will disappear from the session anyway. 
     586 
     587If you need to access a flash attribute from a template, use the `$sf_user` object: 
     588 
     589    [php] 
     590    <?php if ($sf_user->hasFlash('notice')): ?> 
     591      <?php echo $sf_user->getFlash('notice') ?> 
    592592    <?php endif; ?> 
    593593 
     
    595595 
    596596    [php] 
    597     <?php echo $sf_flash->get('attrib') ?> 
     597    <?php echo $sf_user->getFlash('notice') ?> 
    598598 
    599599Flash attributes are a clean way of passing information to the very next request. 
     
    890890    cache:     ~ 
    891891    common:    ~ 
    892     flash:     ~ 
    893892    execution: ~ 
    894893 
     
    916915 
    917916>**TIP** 
    918 >The `enabled: off` parameter works well to disable your own filters, but you can deactivate the default filters via the `settings.yml` file, by modifying the values of the `web_debug`, `use_security`, `cache`, and `use_flash` settings. This is because each of the default filters has a `condition` parameter that tests the value of these settings. 
     917>The `enabled: off` parameter works well to disable your own filters, but you can deactivate the default filters via the `settings.yml` file, by modifying the values of the `web_debug`, `use_security`, and `cache` settings. This is because each of the default filters has a `condition` parameter that tests the value of these settings. 
    919918 
    920919**New in development version** 
     
    989988    cache:     ~ 
    990989    common:    ~ 
    991     flash:     ~ 
    992990    execution: ~ 
    993991 
  • doc/trunk/book/18-Performance.txt

    r4667 r4935  
    553553        escaping_strategy: off    # Output escaping feature 
    554554 
    555 As for the security and the flash attribute features (see Chapter 6), you can deactivate them in the `filters.yml` file, as shown in Listing 18-21. 
     555As for the security features (see Chapter 6), you can deactivate them in the `filters.yml` file, as shown in Listing 18-21. 
    556556 
    557557Listing 18-21 - Turning Features Off, in `myapp/config/filters.yml` 
     
    566566    cache:     ~ 
    567567    common:    ~ 
    568     flash: 
    569       enabled: off 
    570  
    571568    execution: ~ 
    572569 
  • doc/trunk/book/19-Mastering-Symfony-s-Configuration-Files.txt

    r4639 r4935  
    5656`use_database`          | Enables the database manager. Set it to `off` if you don't use a database. | `on` 
    5757`use_security`          | Enables security features (secure actions and credentials; see Chapter 6). The default security filter (`sfBasicSecurityFilter`) is enabled only if it is `on`. | `on` 
    58 `use_flash`             | Enables the flash parameter feature (see Chapter 6). Set it to `off` if you never use the `set_flash()` method in your actions. The flash filter (`sfFlashFilter`) is enabled only if it is on. | `on` 
     58`use_flash`             | Enables the flash parameter feature (see Chapter 6). Set it to `off` if you never use the `setFlash()` method of sfUser. | `on` 
    5959`i18n`                  | Enables interface translation (see Chapter 13). Set it to `on` for multilingual applications. | `off` 
    6060`logging_enabled`       | Enables logging of symfony events. Set it to off when you want to ignore the logging.yml settings and turn symfony logging off completely. | `on` 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.