开发者

passing variables through url in DRUPAL

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜