| | 154 | ### Forcing GET variables |
|---|
| | 155 | |
|---|
| | 156 | According 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 | |
|---|
| | 163 | But 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 | |
|---|
| | 168 | You 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 | |
|---|