Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod
- » MetaMod General Support
- » Limit of lines using php receipe?
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!
28-Aug-12 17:20:02
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
- Index
- » MetaMod
- » MetaMod General Support
- » Limit of lines using php receipe?
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Total Posts Today:
- 1
- User Info:
- Total Users:
- 7638
- Newest User:
- moner86658
- Members Online:
- 0
- Guests Online:
- 146
- 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