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.

 

Limit of lines using php receipe?

Limit of lines using php receipe?

I have followed the receipe which help to display different modules on different domains.
(http://www.metamodpro.com/metamod/recip … subdomains)

I have 30 different domains. The receipe only works on the first 6 domains so I wonder if there is a limit of how many lines I can use?

My php receipe:
if ( $core_genius->check("domain = xxx1.no" ) ) return 100;
if ( $core_genius->check("domain = www.xxx1.no" ) ) return 100;
if ( $core_genius->check("domain = xxx2.no" ) ) return 127;
if ( $core_genius->check("domain = www.xxx2.no" ) ) return 127;
if ( $core_genius->check("domain = xxx3.no" ) ) return 128;
if ( $core_genius->check("domain = www.xxx3.no" ) ) return 128;
if ( $core_genius->check("domain = xx4.no" ) ) return 129;
if ( $core_genius->check("domain = www.xxx4.no" ) ) return 129;
if ( $core_genius->check("domain = xxx5.no" ) ) return 130;
if ( $core_genius->check("domain = www.xxx5.no" ) ) return 130;
if ( $core_genius->check("domain = xxx6.no" ) ) return 131;
if ( $core_genius->check("domain = www.xxx6.no" ) ) return 131;
if ( $core_genius->check("domain = xxx7.no" ) ) return 133;
if ( $core_genius->check("domain = www.xxx7.no" ) ) return 133;
.... and so on..

Btw: Sorry if it already has been answered. I have tried to search but as you might see English is not my mother language, so I'm not to good at searching. If it has already been answered I'm grateful if you could link to an answer. Thank you!

Edited By: _mickeyknox_
28-Aug-12 17:20:02

_mickeyknox_
Beginner Modder
ranks
useravatar
Offline
2 Posts
Administrator has disabled public posting

Re: Limit of lines using php receipe?

Hi Mickey,

There's no hard limit on the number of lines, so there must be some other reason why this is not working properly. Sometimes there's a stray character in the code that's invisible... so maybe that has something to do with it?

A couple of other points to note:

1 - try turning on debug mode (the one in MetaMod) then try those extra domains. The debug mode should indicate which module id is being returned. So perhaps the module ids for the domains after #6 are incorrect? Debug mode should tell you that.

2 - you can simplify the rules by including both domains in 1 statement.

e.g.
if ( $core_genius->check("domain = xxx1.no, www.xxx1.no" ) ) return 100;
if ( $core_genius->check("domain = xxx2.no, www.xxx2.no" ) ) return 127;
// etc...

If you have a lot of these checks, a more efficient way of doing the tests is like this. The PHP will run faster even though there's a little more code:

$domain = $core_genius->info("domain");
switch ($domain) {
  case "xxx1.no":
  case "www.xxx1.no":
    return 100;
  case "xxx2.no":
  case "ww2.xxx1.no":
    return 127;
// add the rest here in the same way
}


In PHP there are lots of ways to express the same thing. The way you were doing it is fine except not as fast to run (for large numbers of domains) and a bit repetitive and possibly error prone because it's more to type/maintain.

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
3312 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1667
Total Polls:
6
Total Posts:
5909
Posts this week:
1
User Info:
 
Total Users:
10121
Newest User:
brian01731
Members Online:
4
Guests Online:
281


Forum Legend:

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