Hi Dave<div><br></div><div>Thanks for the hint. Furtunately url() flattens the query into a string if it's an array, before it calls <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">custom_url_rewrite_outbound().</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Regards</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">Ernst</span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; "><br>
</span></div><div><br></div><div><br><div class="gmail_quote">2010/11/19 Dave Reid <span dir="ltr"><<a href="mailto:dave@davereid.net">dave@davereid.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Ernst,</div><div><br></div>Keep in mind that $options['query'] can also be an array, so your code will fail if I try to do url('mypath', array('query' => array('foo' => 'bar'));<div>
<br clear="all"><font color="#888888">Dave Reid<br><a href="mailto:dave@davereid.net" target="_blank">dave@davereid.net</a></font><div><div></div><div class="h5"><br>
<br><br><div class="gmail_quote">On Fri, Nov 19, 2010 at 2:33 AM, Ernst Plüss <span dir="ltr"><<a href="mailto:ernst.pluess@gmail.com" target="_blank">ernst.pluess@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry for the noise! I Just realized that the $options array is passes by reference to custom_url_rewrite_outbound as well. This means the correct code looks like this:<div><br></div><div><div>function custom_url_rewrite_outbound(&$path, &$options, $original_path) {</div>
<div>
<div> if (isset($_GET['iframe']) && 'on'==$_GET['iframe']) {</div></div><div> $options['query'] .= (strlen($options['query'])>0 ? '?' : '') . 'iframe=on';</div>
<div> }</div><div>}</div><div><br></div><div>Regards</div><div>Ernst</div><div><br></div><br><div class="gmail_quote">2010/11/19 Ernst Plüss <span dir="ltr"><<a href="mailto:ernst.pluess@gmail.com" target="_blank">ernst.pluess@gmail.com</a>></span><div>
<div></div><div><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Drupalfriends<div><br></div><div>I'd like to add a query string to every url. If the URL is '/node/234' it should change to '/node/234&iframe=on'.</div>
<div><br></div><div>I found the custom_url_rewrite_outbound function and added it to my settings.php:</div>
<div><br></div><div><div> if (isset($_GET['iframe']) && 'on'==$_GET['iframe']) {</div><div> $path .= (strpos($path, '?') !== FALSE ? '&' : '?') . 'iframe=on';</div>
<div> }</div></div><div><br></div><div>This works fine, but the url() method, which calls custom_url_rewrite_outbound runns $path through drupal_urlencode() afterwards. This means the url changes to '/node/234%3Fiframe%3Don' which obviously does not work.</div>
<div><br></div><div>Am I doing something wrong or is there another way of getting this to work?</div><div><br></div><div>Regards</div><div>Ernst</div><font color="#888888"><div><br></div>
</font></blockquote></div></div></div><br></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>