Development

Changeset 1229

You must first sign up to be able to contribute.

Changeset 1229

Show
Ignore:
Timestamp:
04/19/06 13:10:35 (3 years ago)
Author:
francois
Message:

documented query_string option for link_to helper

Files:

Legend:

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

    r1158 r1229  
    152152    <a onclick="if (confirm('Are you sure?')) { window.open(this.href); };return false;" href="/fo_dev.php/shoppingCart/add/id/100.html">add to cart</a> 
    153153 
     154### Forcing GET variables 
     155 
     156According to your routing rules, variables passed as parameters to a `link_to()` are transformed into patterns. The default rule transforms `?key=value` into `/key/value`: 
     157 
     158    [php] 
     159    <?php echo link_to('interesting article', 'article/read?title=Finance_in_France') ?> 
     160    // will generate in the URL 
     161    http://myapp.example.com/index.php/article/read/title/Finance_in_France 
     162 
     163But what if you actually need to keep the GET syntax, i.e. to output an url like: 
     164 
     165    [php] 
     166    http://myapp.example.com/index.php/article/read?title=Finance_in_France 
     167 
     168You should then put the variables that have to be forced outside of the `url` parameter, in the `query_string` option: 
     169 
     170    [php] 
     171    <?php echo link_to('interesting article', 'article/read', array('query_string' => 'title=Finance_in_France')) ?> 
     172 
    154173button_to helper 
    155174----------------