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.

 

Damned silly question

Damned silly question

We, among other sites that we use Chameleon for, we have an LMS portal that currently serves 40+ senior schools on one Caribbean island, with each school having its own template, home and about us page and a unique menu.We alias subdomains and check HTTP header forwarding on the root site. So 40+ rules. All works well and seamlessly. Now we need to go to the next island, maybe around 150 schools.

After that Island 3, maybe in excess of 250 schools.

Think you can see where this is going.

Once we've covered the Caribbean (probably 1000+ or more) then the UK or USA or both.

So, being realistic, how many rules (ish) can we use before we get a degradation of server load speed? Doesn't matter if you're using if, then, else or case - There's got to be a trade-off.

Some guidance or ideas would be very welcome.

We only want to maintain one portal for the LMS site otherwise syncing becomes an issue. Other portals could follow.

Thanks,

Ian C

ianc
Doctor or so they tell me
Beginner Modder
ranks
useravatar
Offline
18 Posts
User info in posts
Administrator has disabled public posting

Re: Damned silly question

Hi Ian,

thanks for getting in touch. I'm impressed with the use to are putting this to!

That's a good question about the number of rules, performance, and how to maintain the system as it expands.
I don't have a lot of data on performance.  My main experience with doing this was about 8 years ago on Joomla 1.5, with probably about 40 rules that included lots of regexes and checking of out-of-date page URLs. I did some timing of page loads with and without all the rules in place and saw that there was a performance hit. I think it was almost a second.... bear in mind this was a log time ago on slower servers etc, and some very particular PHP code was being run. To boost performance I put in some rules at the very beginning of the rule chain that detected "normal" URLs and bypassed all the rest of the Chameleon rules if it knew it dodn't need to check them. Make sense? It helped performance considerably.

In your case, I think you have 2 considerations: performance and maintainability. The more rules you put in, the more complex it is to maintain them and make changes if your requirements change.

So at some stage I would suggest that you consider how to generalise your rules.
Instead of this:

Rule 1: detect example1.com, redirect to example.com/page1
Rule 2: detect example2.com, redirect to example.com/page2
Rule 3: detect example3.com, redirect to example.com/page3

... you could set it up with 1 rule that either consults a database table, or in which you maintain an array of domain names inside PHP. The detection part of the rules tends to be easier to do in PHP than the action part.

There are some clever things you can do with actions, so that the actions are more "dynamic" and controllable from the PHP. For example, redirections and dynamic find-and-replace actions can use PHP variabl substitutions, so that you can set a global variable inside PHP then the Action can use the value of that variable.

Also, if you are doing a lot of unpublishing of menu items, then you could consider using the "Unpublish menu items where note…" control. Because menu items can have an internal "Note" on them, you can use the control in Chameleon to unpublish all menu items where the Note equals/matches "SOME_STRING". Then, to change which menu items are going to get unpublished, you just change the notes on the menu items rather than having to edit a Chameleon rule action. If you need it, I could even extend that to be dynamic (allow you to turn off menu items that match the global variable $foo, so you could set global $foo in advance in PHP).

Ultimately if you're dealing with 1000+ schools (domains?) then you are probably going to end up with other bottlenecks as well, like a proliferation of menu items, and frankly just huge traffic, so you'll need to get some advice on your entire infrastructure as well.

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

Re: Damned silly question

Heay Stephen,

Sorry for the delay in replying

As I am sure you will remember, we are web hosting ISPs so extra subdomains for us are not an issue.

After nearly three weeks of banging my head againt some of the most illogical of my web developers (they just don't seem to see the bigger picture most of the time) I may have an alternative.

It will not work for all but it may work for some.

Let's take most of the work away from Chameleon. How will this work?

We set up a TLD on one of our servers and run unique subdomains against it. Each sub domain is its own entity, independent. Yes it will need an individual template and would need the home page and about us page massaged a little but that would be required if each of the subdomains were running through a single site. So far not really any duplication of effort.

Then Our Portal Page - runs through an iframe on each sub site (any iframe on any site with a unique URL).

If somebody visits our page directly (captures a URL from the iframe say??) we need to show a full site template, if the site  displays through a subsite iframe we need to use a "white label" template.

That's where we need to switch templates if we execute the iframe from a sub site.

Now, because we run an external affilliate system, we will have a constant string literal embeded in that iframe URL, and we put a cookie on the users system and also log their IP so if they return within XX months from that system or that IP the then origianal affiliate gets the credit (maybe?).

If I suggest, for example, that the iframe URL consists of "httpS://mysite.com/?AID=fred", I believe you allow us to test the HTTP header for content.

So Simply:- 'If Http header contains "AID" then template else default-template'

So where does that put us? A separate sub domain for each school and the DNS server deciding what it is doing. Most of the load taken from Chameleon and it can function with just two rules or maybe just one - using the default. We'll get more sexy with menu option in time.

Does that work? Is it really that simple? I just love simple.

If you think it does then please tell me the rule(s) I need please.

Many thanks,

Ian

(didn't remember I put a sig in here)

Thanks,

Ian C

ianc
Doctor or so they tell me
Beginner Modder
ranks
useravatar
Offline
18 Posts
User info in posts
Administrator has disabled public posting

Re: Damned silly question

Hi Ian,

It's good to be thinking laterally like this. I'm trying to wrap my head around the setup you're describing, so let's delve into it a bit.

If you use an iframe to a URL, the server only sees the URL that it gets sent (it won't see the URL of the page that embedded the iframe). If the user clicks on a link in the iframe, the iframe URL gets replaced with the new URL, and the server will no longer see the original URL. Therefore, if you want the iframe to maintain state (branding), you need to get it to remember the initial entrance info via cookie, session variable, or some other means.

One alternative method is to actually do it via (sub)domain name. So instead of http://mysite.com/?AID=fred", use http://fred.aff.mysite.com/. The advantage of this is that it remembers the state without use of cookies or session variables. All relative links inside the site will maintain the domain name, and your PHP (or Chameleon) pages can pick it up any time.

Is this any help?

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

Board Info

Board Stats:
 
Total Topics:
1684
Total Polls:
6
Total Posts:
5940
Posts this week:
1
User Info:
 
Total Users:
5162
Newest User:
david30x73
Members Online:
0
Guests Online:
127

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