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.

 

Metamod for subdomains

Metamod for subdomains

I trided metamod for subdomains, however, when I paste the following code it doesn't work
$domain = $_SERVER['HTTP_HOST'];
switch($domain) {
case "torun.studioverra.com": return 153;
}
the subdomain is correct, the module number is correct, but the actual module doesn't appear at all. Other commands work perfect, but what's wrong with this one? Any ideas??
PS. The module doesn't appear even if
case "studioverra.com": return 153;
is typed in...
Thanks for any help,

Mariusz

Edited By: mariuszstach
14-Mar-10 17:48:32

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

Hi Mariusz,

just to make sure that $_SERVER['HTTP_HOST'] is providing the right information, I suggest that you put the following into the MetaMod PHP box:

echo "<pre>";
print_r($_SERVER);
echo "</pre>";

Then view the page on the front-end of the site, via the 2 different domains, and see what results you get.

In the array that's shown, you should see a line like:

[HTTP_HOST] => torun.studioverra.com

Do you get that? If not, then look through the other $_SERVER variables displayed and see if there's anything else that you can use, or if it has a different name or something like that. Perhaps you're using IIS instead of apache?

Hope that helps,
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: Metamod for subdomains

Hi Stephen, I just checked and I do get that info:) - still the module doesn't appear when the command is typed in...

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

Problem solved Stephen. I'm not a php programmer but this direction gave me a solution
[HTTP_HOST] => torun.studioverra.com
Actually my server gave this: [HTTP_HOST] => www.torun.studioverra.com
So I added www in front of the address and it works. Thanks a lot for your help:)
Mariusz

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

I wonder if it's possible to ask Metamod do the following: I want to display module 1 if the address is open from subdomain A and display module 2 in all other cases (subdomain B, C, D etc)... Probably it's very simple but still not for a chemist:)
Thanks for help,
Mariusz

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

This is a simpler way to do the rule. This would replace the rule that you are using at the moment:

Code:

$domain = $_SERVER['HTTP_HOST']; 

if ( $domain == "www.torun.studioverra.com" ) return 153;
else return XXX; // replace XXX with the module id to use for all other subdomains

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: Metamod for subdomains

Works like a charm:),
Thanks a lot Stephen

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

Hi Stephen,
Sorry for bothering you again. Ald what would be the roule for the following conditions:
- if the domain is www.a.com please return 1
- if the domain is www.b.com please return 2
- else please return 3smile
I know that if/else has to be applied somewhere here

$domain = $_SERVER['HTTP_HOST']; if ( $domain == "www.torun.studioverra.com" ) return 153; else return XXX; // replace XXX with the module id to use for all other subdomains

but after a few trials I gave up...
Thanks in advance,

Regards,Marius

mariuszstach
Beginner Modder
ranks
useravatar
Offline
12 Posts
Administrator has disabled public posting

Re: Metamod for subdomains

$domain = $_SERVER['HTTP_HOST'];
if ( $domain == "www.a.com" ) return 1;
if ( $domain == "www.b.com" ) return 2;
return 3;

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:
1686
Total Polls:
6
Total Posts:
5933
Total Posts Today:
7
User Info:
 
Total Users:
4432
Newest User:
kinggambling14
Members Online:
0
Guests Online:
163

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