Log in

View Full Version : Overriding StyleSheet called by PHP?



TheJoshMan
02-22-2008, 03:19 AM
Hi,
I have a site I'm building where I'm strictly the middle-man. The layout of the site is mine, but the content is in an IFRAME which is written via PHP. Now, my site BG is Black, but the BG of this IFRAME is white... Is there anyway to override the stylesheet that the php is calling in the IFRAME to change the background color?

Nile
02-22-2008, 03:22 AM
I do not think that this is possible

But can we please see a link to your site?

jscheuer1
02-22-2008, 03:26 AM
If the two pages are on the same domain, javascript can alter the style of the document in the iframe. Or - better still with PHP, instead of an iframe, you could include the external file. If you do that, it can be made to follow the style on the 'top' page.

TheJoshMan
02-22-2008, 03:37 AM
sorry it took so long to reply... i changed my email on here and had to wait for the confirmation email to be able to post anything... Anway, the IFRAME isn't hosted on my site. It's a bunch of website templates for sale through some big corporate entity and I get a percentage... Here's the link so you can take a look, it's all pretty new, I just opened it up yesterday.

http://www.m-pulsedesigns.com

Nile
02-22-2008, 03:44 AM
Well, I think that you could use JS in the iframe src, that would make the bg black.

TheJoshMan
02-22-2008, 03:46 AM
How exactly would I manage that? I've never seen a script that would change a color specified by an external stylesheet... any ideas?

Nile
02-22-2008, 03:48 AM
Well, I know how you could do it, but I don't know how you would also have the src that website. Why not copy all of there source on there website and choose one? Its not that much different.

jscheuer1
02-22-2008, 03:52 AM
There's not a lot you can do with a page from another domain, nothing in fact if the server on that domain, or yours is configured to prevent it. However, there are many variables in the query string for that URL that allow you to change the text displayed, perhaps there are others available that would change the background and/or foreground colors. Check the documentation and/or forums of the host who provides this content for more information.

TheJoshMan
02-22-2008, 03:55 AM
thank you both for the info... I'll be sure to check out their fAQ and such, maybe I can find something there.

Nile
02-22-2008, 03:56 AM
Why not just view there source and do it like that? Then you can make your base, there website. Right? It'd be easier...

TheJoshMan
02-22-2008, 04:37 AM
I thought about doing it that way... but they use alot of PHP in that IFRAME, i've searched through their source and it calls one PHP page that calls another if you search for something and so on... and I do NOT know PHP. I've tried to learn it, but I can't seem to get the hang of it. So if I were to copy their source and put it in my page directly then I would have to go through manually everyday and update the most recent designs for sale and so on.

jscheuer1
02-22-2008, 05:10 AM
Well, there is a way, if both servers allow it, to import the content of the other page and then serve it the way you want to. Care must be taken to to preserve any relative paths on the imported content to become absolute ones on your version if you still want them to point to the same place on their server.

TheJoshMan
02-22-2008, 07:15 AM
how would i tell if both servers allow it, and if so, how would i do it?

jscheuer1
02-22-2008, 02:42 PM
Oddly, it probably depends more upon your server and its settings, rather than upon the remote host. This thread:

http://www.dynamicdrive.com/forums/showthread.php?t=16567

which started out discussing how to grab the title from a remote page, also shows how to grab the entire page via PHP, and includes discussion on the limitations of this approach.

Basically, your server must be PHP enabled, not in 'safe mode' and not have any of the required PHP commands blocked for your domain. If you don't have PHP available on your host, but do have asp or some other server side language, there may be a way to do it in that language.

However it is done, what you will get is the served HTML markup of the remote page, and as I said before, if any of the paths in that markup are relative, they will no longer be accurate on your server, but could be converted to absolute paths there, so that they will still work in 'your copy' of the page.

TheJoshMan
02-22-2008, 03:15 PM
WHEW! I got a headache just from READING that post... I think I'll just change my page to "white" and forget about the whole thing... just turning out to be far too complex for my sleep-deprived mind!

Thanks though.