Print
EmailSo while creating the master pages and such for the American Institiute of Aeronautics and Astronautics (deep breath). They needed a way to tell where the user is on the site and show them a header image based on where they are. For example, if they are on a potential student page they would be shown a student, if on a page for professionals, they are shown a professional etc, etc. So really the only specific thing that you can stick in a master page (that i could think of at the time) would be something that reads the URL.
So we came up with this script that would read the URL then parse out everything in the main domain and everything after the first SUB site path For example. If a user went to www.ericharlan.com/sitex/123/default.aspx, the script would produce just sitex .
So what we did was created a flash header that had a default random image that would display if the variable came back undefined (which means the user is on a page that isnt defined as one of the variables the flash is looking for OR, there was an error in the script) the image based back was on a random 30 rotation, so the same "error" image would never show twice. Then we would create out site hieracrhy with attention to the subsites, each categroy of the site (students, professionals, etc) having their own set path name. We then create the flash header to look for these subsites (aka the variable the script was passing.And blamo, there you have it site header image based on site location.
Here is the script.
<script language="Javascript">
<!--
var showImage = location.pathname;
showImage = showImage.replace("/", "");
showImage = showImage.replace(/(\/.*)/ , "");
/* document.write(showImage); */ /*Uncomment this if you want to check if the variable is being passed, It will display it at the top of the page*/
//-->
</script
Please wait while my tweets load 
| Weight Loss or Bust - So did it work? Updated: January 2, 2012 |
| SharePoint Search and DisableLoopBackCheck Updated: December 18, 2011 |
| SharePoint Conferences 2011 + Asia Updated: November 15, 2011 |
| It’s sick, but I love the turbulence. Updated: November 15, 2011 |
| Cruise on up to the Med Updated: October 22, 2011 |
| SPC11 MSPFE Meet and Greet Updated: September 30, 2011 |
| Ebay, you reek of Idiocy Updated: July 6, 2011 |
| Hard CORE AD Core setup for SharePoint Updated: May 31, 2011 |