开发者

passing variables through url in DRUPAL

开发者 https://www.devze.com 2023-03-11 00:46 出处:网络
Whenever I try to pass a variable through url with the l() function like: l(t($row[\'salon_name\']),\'admin/content/edit-salons-products-services?sid=\'.$row[salon_id] );

Whenever I try to pass a variable through url with the l() function like:

l(t($row['salon_name']),'admin/content/edit-salons-products-services?sid='.$row[salon_id] );

? is replaced by "%3F"

= is replaced by "%3D"

Why is this happening and 开发者_如何学编程how can I fix it?


Change it to: 'admin/content/edit-salons-products-services/.$row[salon_id]'.

You can access the salon id with arg(3).

You may also need to change your module's menu declaration to allow this URL.


As Finbarr said, it's often better to pass variables as path components, rather than query parameters, but query parameters are still possible with l().

Query parameters are passed into l() outside the base $path, in the $options parameter. This makes it easier to programmatically alter query values, without needing to parse a string. What you want is something like this:

l(t($row['salon_name']),'admin/content/edit-salons-products-services', array('query' => array('side' => $row['salon_id'])));
0

精彩评论

暂无评论...
验证码 换一张
取 消