I have a website I'm building for a group of companies. There are 10 companies and a Group website.
Previously each of the 10 sub-sites was contained within its own directory but gained some of their common resources from a directory in the parent directory. This was done by means of an Apache Alias command in the httpd.conf file because each of the domain names had to point to its relevent sub-site but the sub-site still needed to be navigable from the group website.
Ok that's how it was working, but the site was all in HTML then and it's a pain in the ass to update. For this reason I intend to shift the whole lot to a PHP driven site and use a single template.
The site is in frames (yeah I don't like it either but the client gets what they want and there's no other way to do it). The navigation for each sub-site appears in one frame, the content in another. Since they all have the exact same layout for navigation I want to avoid using multiple files but the navigation links will obviously have to point to different pages depending on which sub-site you are in. I don't want to continually re-load the navigation to change the link variables as you navigate between sub-sites though so I thought I would instead track the current site you are viewing with a session variable.
So this is how it works. I'm using the template system kind of backwards: all links point to the template page directly then the decision on which page will be included is done on that page.
If the user enters through the group domain then the default home page is displayed. The HTTP_HOST is checked and if they are after a single company site then the template would alter the session variable to display the home page for that site. When the user clicks on a link to another site this variable is overridden and the new site pages are displayed. This way the subnavigation links to "about", "contact", "clients" etc all just point to the template and ask for page 1,2,3...
These part pages are held in their relevant sub-directories so the template looks for:
Code: Select all
/resources/$_SESSIONї'sub-dir']/$_GETї'page-id']
*This is just simplified code, yes I do check for valid content and I don't just pass through the GET variable.My problem is that this works perfectly, exactly as descibed, in Safari but not in IE on PC or Mac OR in Firefox.
How is this possible? Surely the browser shouldn't affect how sessions are handled. Is it something to do with the frameset?
I've got session_start() declared in both the navigation frame and the content frame, do I need to declare it in the frameset too event though this is just an emptyish HTML page?
Since I typed the above I did some more searching and I've added
?session_name=session_id to every url including frame src on the site.
I'm still getting the group homepage come up when I click on any of the links on any site sub-navigation so it's ignoring the sub-dir session variable.
Suggestions? Comments? Queries?
EDIT Some hours later...
Done this as an edit as there's no reason to bump this up the page.
I found my problem. It was an unrelated javascript/CSS issue where I had declared a div area in the navigation with an onclick event handler to return to the group homepage.
In IE and MOZ this was accepting clicks ALL OVER THE NAV PAGE including the links so instead of the links accepting clicks this div was instead so I kept getting redirected back to the homepage which is also the default behaviour for page not found. I adjusted the CSS and now it works as it should.
Apologies for wasting your time if you read this.