Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Code to Remove Case Sensitivity for Appended Tags

Code to Remove Case Sensitivity for Appended Tags

My website sometimes requires a visitor to view using a tracking code they append to the url, which also dynamically changes information on the website.  I can't control whether a visitor uses uppercase, lowercase, or a combination of the two in the code.  I need a code that will eliminate the case sensitivity so that my website will return the same information whether uppercase, lowercase, or a combination.

For example, I need the following code examples (that would be appended to the url) to return the same information:

?LID=MMOD 
?LID=Mmod
?LID=mmod
?lid=mmod

Any help would be greatly appreciated.  Thank you in advance.

MishelInitial
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

Before I answer that, can I check that this is about MetaMod? i.e. using MetaMod to control which modules display on the page?

Cheers,
Stephen

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

Yes.  I'm sorry - should have specified.  I'm using Joomla 1.5.20 and MetaMod Version 2.5 .

MishelInitial
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

$uri = JURI::getInstance();
$query = strtolower($uri->getQuery());
parse_str($query, $vars);
$lid = @$vars['lid'];
if ($lid == "mmod") return XXX;
// replace XXX with the id of the module to display when LID=MMOD appears in URL,
// case insensitive.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

Thank you for your help - it's very much appreciated.  I tried the code you wrote and it didn't seem to work.  It's possible I'm implementing it incorrectly.  FYI, here's the code I've been using in case it's helpful in figuring this out:

$instance_name = "shown_module_01";
if ( JRequest::getVar("LID") == MMOD )  $_SESSION[$instance_name] = true;
if ( @$_SESSION[$instance_name] == true) {
return 144; 

else return 23;

The url that works with this would be: http://www.website.com/?LID=MMOD

Since I'm using a big list of LID codes, this section is repeated with the different code (MMOD) and module # (144) changed out appropriately.  As mentioned the code I'm using works fine, but is case sensitive.

I'd like it to also work the same way with something like this: http://www.website.com/?LID=Mmod
or this:  http://www.website.com/?LID=mmod

Thank you again.

MishelInitial
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

Try this:

Code:

$uri = JURI::getInstance();

$query = strtolower($uri->getQuery());
parse_str($query, $vars);
$lid = @$vars['lid'];
$instance_name = "shown_module_01";
if ( $lid == "mmod" )  $_SESSION[$instance_name] = true;
if ( @$_SESSION[$instance_name] == true) {
  return 144;

else return 23;

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

You're a genius!  That works perfectly!!  I can't thank you enough.  big_smile

MishelInitial
Beginner Modder
ranks
useravatar
Offline
4 Posts
Administrator has disabled public posting

Re: Code to Remove Case Sensitivity for Appended Tags

You're welcome smile

"If you use MetaMod, please post a rating and a review at the Joomla! Extensions Directory"

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Total Posts Today:
2
User Info:
 
Total Users:
4367
Newest User:
dixon45621
Members Online:
3
Guests Online:
215


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked