Bob Bedford wrote:
We'd like the customers to manage their own CSS, instead of asking
us to change for them.
<link href="test.css" rel="stylesheet" type="text/css">
<title>No title</title>
</head>
<frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
<frame src="leftmenu.htm" name="leftFrame" scrolling="NO" noresize>
<frame src=www.mysite.com name="mainFrame">
</frameset>
we'd like www.mysite.com to takes the test.css.
How to do so?
You have at least three options:
1. The customer's Web site communicates location of its CSS file
to your site transparently:
<link href="test.css" rel="stylesheet" type="text/css">
<frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
<frame src="leftmenu.htm" name="leftFrame" scrolling="NO"
noresize>
<frame src="http://www.mysite.com/?css=[url]" name="mainFrame">
</frameset>
where [url] is the full URL to the style sheet.
Then your script simply does the following:
echo '<link href="', $_GET['css'],
'" rel="stylesheet" type="text/css">';
The advantage is that is is transparent. The disadvantage is
that the [url] will have to be in URL encoding, rather than
raw, which tends to confuse the less technically adept...
2. The customer's Web site communicates location of its CSS file
to your site via a customer identification code of some kind:
<link href="test.css" rel="stylesheet" type="text/css">
<frameset cols="80,*" frameborder="NO" border="0" framespacing="0">
<frame src="leftmenu.htm" name="leftFrame" scrolling="NO"
noresize>
<frame src="http://www.mysite.com/?cid=234" name="mainFrame">
</frameset>
Then your script can pull a location of the CSS file for
customer number 234 from a database or a text file.
The advantage is ease of use for your client. The disadvantage
is that you need to keep a database of CURRENT URLs to customers'
style sheetes.
3. Your site should know URLs to customer's CSS files and include
them accordingly, depending on who's calling the site. For
example, you can do this:
$parts = parse_url($_SERVER['HTTP_REFERER']);
and then output the link to the style sheet based on
$parts['host'].
In all cases, these options are only good for initial detection.
To keep the style sheet setting, you will need to propagate it
via a CGI variable or a session variable.
Cheers,
NC