function getLocationUrl($market) {
$route = '/' . JFactory::getApplication()->getMenu()->getActive()->route;
$url = '?mc=' . $market;
return $route === '/home' ? $url : $route . $url;
}
$loc_url = getLocationUrl($market_variable_name);<li class="first hoverFix"><a href="/key-west<?= $loc_url ?>-key-west">Key West</a></li>
This question has been answered by rjohnson375. See the first response.
[[~[[*id]]? ¶meter1=`value` ¶meter2=`value` etc...]]
- Tampa -- Hotels -- Restaurants -- Spas -- Activities - Key West -- Hotels -- Restaurants -- Spas -- Activities - Miami Beach -- Hotels -- Restaurants -- Spas -- Activities
- Tampa - Key West - Miami Beach
- Tampa (5) -- Hotels (6) -- Restaurants (7) -- Spas (8) -- Activities (9) - Key West (10) -- Hotels (11) -- Restaurants (12) -- Spas (13) -- Activities (14) - Miami Beach (15) -- Hotels (16) -- Restaurants (17) -- Spas (18) -- Activities (19)
<li class="first hoverFix"><a href="[[~[[UltimateParent? &id=`11` &topLevel=`2`]]]]">Key West</a></li> // This part: [[UltimateParent? &id=`11` &topLevel=`2`]] will be replaced with 10. So your URL will become this: [[~10]] // The rendered URL should be : key-west/ // To get an absolute URL, just add the full scheme to your link tag: [[~[[UltimateParent? &id=`11` &topLevel=`2`]]? &scheme=`full`]]. This should output: http://www.mysite.com/key-west/ // To get http://www.mysite.com/key-west/package-deals/hotels?mc=key-west-miami-beach // Just add package-deals/hotels?mc=key-west-miami-beach after your link tag // <a href="[[~[[UltimateParent? &id=`11` &topLevel=`2`]]? &scheme=`full`]]package-deals/hotels?mc=key-west-miami-beach">Key West</a>
<ul class="dropdown"> <li class="first HoverFix"><a href="[[~[[UltimateParent? &id=`11` &topLevel=`2`]]? &scheme=`full`]]package-deals/hotels?mc=key-west-miami-beach">Key West</a></li> <li class="HoverFix"><a href="[[~[[UltimateParent? &id=`16` &topLevel=`2`]]? &scheme=`full`]]package-deals/hotels?mc=key-west-miami-beach">Miami Beach</a></li> <li class="HoverFix"><a href="[[~[[UltimateParent? &id=`6` &topLevel=`2`]]? &scheme=`full`]]package-deals/hotels?mc=key-west-miami-beach">Tampa</a></li> </ul>
<ul>
<li><a href="tampa/[[switchLanding]]" onclick="updateCookie('tampa');">Tampa</a></li>
<li><a href="key-west/[[switchLanding]]" onclick="updateCookie('key-west');">Key West</a></li>
// etc
</ul><?php
switch ($_COOKIE['market']) {
case "tampa":
$url = $_SERVER['REQUEST_URI'];
switch (true) {
case strstr($url, 'tampa'):
$currenturl = str_replace('/tampa/','',$url);
return $currenturl;
break;
}
break;
case "key-west":
$url = $_SERVER['REQUEST_URI'];
switch (true) {
case strstr($url, 'key-west'):
$currenturl = str_replace('/key-west/','',$url);
return $currenturl;
break;
}
break;
// etc
}