Link URL's not allowing query parameters

Lionsheart's picture
Lionsheart
Mon, 01/25/2016 - 09:12
#1
Link URL's not allowing query parameters

I am using the slider module for Drupal 7. When I try to link text or an object in the slider to a page with a query parameter appended to it. The stored link is garbled or converted to html special characters.

Example:

mysite.org/lander?utm_term=test 

becomes

mysite.org/lander%3Futm_term%3Dtest

phuonght's picture
phuonght
Tue, 01/26/2016 - 02:22

- Please open file sites/all/modules/custom/md_slider/templates/front/theme.front.inc, from line 197 to line 205

replace

if (strpos($link['value'], 'http') === FALSE && strpos($link["value"], "#") !== 0){
$url = parse_url($link['value']);
$options = array();
$options['absolute'] = TRUE;
if (isset($url['fragment']))
$options['fragment'] = $url['fragment'];

$variables["link"] = url($url['path'], $options);
}

with

if (strpos($link['value'], 'http') === FALSE && strpos($link["value"], "#") !== 0){
$url = drupal_parse_url($link['value']);
$options = array();
$options['absolute'] = TRUE;
if (isset($url['fragment']))
$options['fragment'] = $url['fragment'];
if (isset($url['query'])) {
$options['query'] = $url['query'];
}

$variables["link"] = url($url['path'], $options);
}

and just need to input lander?utm_term=test instead of mysite.org/lander?utm_term=test 

Log in or register to post comments
Have More Idea?

We are here to build your website!

No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.