![]() |
CSS question
Ok, so I putting a page in an iframe from a completely different site. The content of this page is utilized on a bunch of different sites, so keeping it in one place so changes can be made once to apply to all domains is essential.
I'm trying to get the content of the page within the iframe to match the site I'm putting it on as far as text/link colors, etc. So, I'm thinking I have to put the iframe in a div id, and in my css file, actually associate the page being pulled, so that way customization I apply in my css will actually affect the contents in the iframe. So here is what I'm thinking for the actual page on the domain: Code:
<iframe scrolling="auto" allowtransparency="true" frameborder="0" height="225px" width="720px"> I know this is not right, but something like: Code:
I'm finally trying to get off of just basic html coding and on to stuff that was only outdated 5 years ago instead of 10. :winkwink: |
just to verify, you have a page on your server that you would like to duplicate on other sites but change the colors, sizes etc via css right? or is it a page from another website?
Edit: Can you modify the page in the iframe is what am trying to ask. sorry, a bit sleepy |
Here is a very simple example. I would out the css in my main stylesheet but put it on the main page for simplicity.
Lets say you have mainpage.php and textpage.php. Your mainpage.php could be something like this: Code:
<html> Code:
<div id="frameStyle"> Code:
<cfinclude template="textpage.cfm"> Code:
<!--#include file="textpage.inc"--> This is assuming you can add the proper ids and classes to the content page you want to include in your various sites. Best of luck |
You're going to run into same origin issues trying to style the content of a page loaded from another domain. It may appear to work in some versions of some browsers, but the trend is toward stricter controls on cross domain access.
You can use jquery to pull it into your domain: <html> <header> <script src="/js/jquery.js" type="text/javascript"> </header> <body> <div id='include-from-outside'></div> <script type='text/ javascript'> $('#include-from-outside').load('http:// example.com/included.html'); </script> </body> </html> In a noscript stanza you can put the unstyled iframe or iframe a copy pulled to your server periodically. |
In a nutshell, it's a "warning blurb" that the person I'm doing some stuff for has on all of her sites. The warning itself is an html page that is hosted on one of her domains. She has it in a iframe on a bunch of her sites, but they all have the default color scheme from the site that the warning.html page is hosted on. I'm putting it on a site I re-vamped, and want the text/link colors in that file to match the site I re-vamped, not the one it's hosted on.
I made the iframe transparant, but short of copying the file onto the domain I re-vamped and hosting it there, I was told by someone else to code it into the CSS file, which I'm at a loss for. I'd just put it on the domain I revamped and pull it from there, but should the master file get changed elsewhere, I won't get those changes on the new site. Edit: Just saw the replies...reading now... |
Quote:
iframe.html can reference style.css and it'll use style.css from the current site. |
Ah, sorry. Without the details I may have misunderstood what you were going for.
I am sure raymor knows more about the warning page stuf than I would =D good luck with it! |
Quote:
Also assuming the pages use other PHP - at least until PHP 6.0 comes out I tend away from needlessly executing all documents as programs. |
you can't do what you're asking, the way you're asking.
even if you trick it into working with js/jquery it would raise security warnings in certain browsers because if cross frame scripting. just make your own duplicate of the iframe on the same domain or take the content of the iframe and stick it inline. then style it however the hell you want. |
Try doing it as a php include.
|
Read the file in php with fopen, filegetcontents...and print it out on your page. But I don't know if crossdomain is allowed.
|
All times are GMT -7. The time now is 08:02 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123