I would like to know how I can include additional URL parameters to a given link? ie: 'news?pid=3'
<?php
print $path='news?pid=3';
?>
This returns page not found error as the '?' is getting printed as %3F.
正确答案
12 | If you are using
If you have other query parameters, you can add them in like this:
and that would create More information on |

Comments
Comment#1
pwolanin CreditAttribution: pwolanin commentedAre you passing your query in as the fourth parameter of l() ?
http://api.drupal.org/api/5/function/l
I only see $path being subjected to the treatment you describe.
Comment#2
kenorb CreditAttribution: kenorb commentedThe same problem.
Related:
#40094: check_url function now creates unusable urls when module adds a query string
Comment#3
kenorb CreditAttribution: kenorb commentedCode:
l($text = 10, $path = 'search/all', $options = array ('path' => '/search/all', 'query' => array ('s' => 'teacher', 'items_per_page' => 10)));Generated URI:
Comment#4
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis is by design.
See #399488-16: Invalid markup generated by l(). for context.
Comment#5
kenorb CreditAttribution: kenorb commentedThank you.
Comment#6
ramsunvtech CreditAttribution: ramsunvtech commentedSimply decode the Output of l (link) function
<?php$options = array('attributes' => array('class' => 'fancybox btn'),'query' => array('popup' => TRUE));print l('Download patiëntenfolders', 'overzicht-folders/'.$node->nid, $options);?>How will you add the query string in url using l() function?If you want to use the l() function and provide the destination:l('Login first','user/login', array('query' => array(
'destination' => 'node/'. $node->nid
)
)
);
?>
The above code will provide you with an anchor tag with the href pointed touser/login?destination=node/NIDThis is only useful if you are linking to a page that consist of a form, and you want the user to be redirected to another page after submitting the form.Ref: http://api.drupal.org/api/drupal/includes--common.inc/function/l/6