The project is a quick proof of concept. If successful, there will be a follow-on project to implement in a more robust manner.
The goal is to create a php script that extracts content from files on a site which currently uses frames, and serves it from a different domain using tables. The end result will be visually similar to the source, but will now have the advantages of a non-frames site.
By capitalizing on the systematic naming conventions in the frames version, and use of the $_SERVER['HTTP_REFERER'] variable, ? the hope is to reproduce most of the functionality (including the ability to navigate within a subframe while the outer frames contents remain as is.
This script will run as the 404 handler on the new domain. By setting the base href in the generated files to the new domain, following links will reinvoke the script as the user navigates around the site.
## Deliverables
1] INTRODUCTION
The project is a quick proof of concept. If successful, there will be a follow-on project to implement in a more robust manner.
The goal is to create a php script that extracts content from files on a site which currently uses frames, and serves it from a different domain using tables. The end result will be visually similar to the source, but will now have the advantages of a non-frames site.
By capitalizing on the systematic naming conventions in the frames version, and use of the $_SERVER['HTTP_REFERER'] variable,? the hope is to reproduce most of the functionality (including the ability to navigate within a subframe while the outer frames contents remain as is.
This script will run as the 404 handler on the new domain. By setting the base href in the generated files to the new domain, following links will reinvoke the script as the user navigates around the site.
2] NOTES
The site implemented with frames that includes the source content is: <[login to view URL]>
The test domain for this project will be: <[login to view URL]> (currently not in use for UI).
In the source files, opening Body tags sometimes have color specified - which can be ignored).
In the following I designate variables with square brackets.
Since this is the 404 handler, page not found errors will need to be shown when the requested file does not exist on counterbalance.net. See below.
3] PROGRAM LOGIC: SETTING UP VARIABLES FROM THE REQUESTED AND/OR REFERING URI
Get the referring URI from $_SERVER['HTTP_REFERER']
Get the requested URI from the $REQUEST_URI
Set the current topic-set variable "[CURTOPICSET]" below to the directory in the filename requested. (e.g. "genetics" for "<[login to view URL]>").
If the filename ends in "[login to view URL]" set the current topic variable "[CURTOPIC]" to the first part of the filename up to the dash (e.g. "index" for "<[login to view URL]>").
? ? else, if the referring domain includes "counterbalance"
? ? ? ? ? ? ? ? set the [CURTOPIC] to the first part of the referring filename up to the dash (e.g. "index" for "<[login to view URL]>").
? ? else, set the [CURTOPICSET] to "stdweb" and the [CURTOPIC] is set to "home"
4] PROGRAM LOGIC: EXTRACTING THE CONTENT TO BE USED
First, [NAVBAR] is set to the contents between the <body> tags in "/stdweb/[login to view URL]"
Then [HEAD] is set to the contents of the <head> of <[login to view URL][CURTOPICSET]/[CURTOPIC][login to view URL]>
Then [BODY] is set to the contents of the <body> of <[login to view URL][CURTOPICSET]/[CURTOPIC][login to view URL]>
? ? If this file is not found [BODY] and [HEAD] are set to the <body> and <head> of /404bodynotfound.html.
Then [TOPICS] is set to the contents of the <body> of <[login to view URL][CURTOPICSET]/[CURTOPIC][login to view URL]>
5] SERVING THE CONSTRUCTED PAGE
Loads these variables into the following template, and serve it.
_________________
<html>
<head>
[HEAD]
<base href="<[login to view URL][CURTOPICSET]/>">
<script src="../scripts/[login to view URL]" language="JavaScript"></script>
</head>
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
<table border="0" width="100%" cellspacing="0" cellpadding="0" bordercolor="#FFFFFF" bgcolor="#FFFFFF">
<tr>
? <td width="100%" valign="top">
? ? ? [NAVBAR]
? </td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0" height="100%">
<tr>
? <td class="maintextbody" width="66%" valign="top"">
? ? ? <table border="0" width="100%" cellspacing="15" cellpadding="0">
? ? ? ? ? <tr>
? ? ? ? ? ? ? <td class="maintextbody" width="100%" valign="top">
? ? ? ? ? ? ? ? ? <p>[BODY]
? ? ? ? ? ? ? </td>
? ? ? ? ? </tr>
? ? ? </table>
? </td>
? <td valign="top">
? ? ? <table border="0" width="100%" cellspacing="10" cellpadding="0" bgcolor="#FFFFFF" height="100%">
? ? ? ? ? <tr>
? ? ? ? ? ? ? <td valign="top" bgcolor="#FFFFFF">
? ? ? ? ? ? ? ? ? <p>[TOPICS]
? ? ? ? ? ? ? </td>
? ? ? ? ? </tr>
? ? ? </table>
? </td>
</tr>
</table>
</body>
</html>