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.

 

need a case by case variable for a keyword in URL

need a case by case variable for a keyword in URL

i need to show modules based on keywords found in the URL.

Example, in this URL I have the word "automobiles": hxtp://www.ehrcompare.com/reviews/automobiles

The keyword may be in any number of locations in the URL, so I can't be very specific - just that the word is in the url somewhere.

I have a working metamod that uses this but it's too specific:

Code:

if ( JRequest::getVar('url') == 'search-results' ) { 

  $brand = (JRequest::getVar('jr_specialties'));
  switch ($brand) {
    case "Allergy": return 382;
    case "Audiology": return 383;

How could I rewrite that code so that the keyword can be anywhere in the URL?

thepiston
Junior Modder
ranks
useravatar
Offline
29 Posts
Administrator has disabled public posting

Re: need a case by case variable for a keyword in URL

Hi,

I would use the following JomGenius code:

if ($core_genius->check("url contains automobiles")) return 383;
if ($core_genius->check("url contains allergy")) return 382;

That should do it :-)
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: need a case by case variable for a keyword in URL

works perfectly. Did a quick find/replace and changed about 100 lines quickly.  thank you!

thepiston
Junior Modder
ranks
useravatar
Offline
29 Posts
Administrator has disabled public posting

Re: need a case by case variable for a keyword in URL

Great, glad that worked, thanks for reporting back.

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

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
4
User Info:
 
Total Users:
4384
Newest User:
rash39381
Members Online:
0
Guests Online:
193

Online: 
There are no members online

Forum Legend:

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