![]() |
Applying Stylesheet to IFRAME contents
I'm using vbadvanced and have created a module to show information in an IFRAME.
However, the contents of the IFRAME is never formatted according to what I've set up in my style. The contents always has a white background with black text in Times New Roman. Is there something I'm missing? I've tried to include a class="alt1" in the IFRAME tag and have even surrounded the contents of the HTML file in <span class="alt1"> tags, all to no avail. Included is an example: HTML Code:
<td class="$getbgrow alt1" width="100%" align="center"> HTML Code:
<span class="alt1"><strong>Blah blah blah ...</strong><br /><br />Blah blah blah</span> |
I think the iframe page needs access to the style sheet on it's own, since it's loaded separately. That's just a guess :) To test this guess, save a copy of your stylesheet to a file, and add the file to the iframe page...
|
Quote:
- Sid |
Quote:
|
that iframe is simply a page, so you need to use $headinclude to get the CSS properly.
|
Quote:
Quote:
PHP Code:
- Sid |
I'm trying to do the same thing. Solved the problem by putting $style[css] in the <head> tags.
|
Quote:
|
Put it this way:
<? echo $style['css']; ?> |
Quote:
Now, I've done what you've said and this is the code I've got: HTML Code:
<html> But when I do this, I just get a white background with black text and no formatting other than the bold and line breaks in the scrolling IFRAME. Can someone tell me what I'm doing wrong? - Sid |
Quote:
HTML Code:
<? require_once('global.php'); ?> |
Actually, no warning occurs and no changes either :(
It still shows a white background with black text. - Sid |
We may have missed something very simple. alt1 and alt2 do not apply to <span>, I don't think.
You can test by accessing ther iframe page directly from the browser, and view the source, to see if the style is there as expected. |
Quote:
Even if the alt1 and alt2 aren't working properly, shouldn't the colour work? ...and the font? I know that people have used IFRAMEs to display things like the shoutbox, etc. - Sid |
I'm not sure because I don't have the files.
But what happens when you view the page source? What style is defined there? |
The source, when viewing the file directly in a web browser doesn't expand the PHP script at all!
It just shows the literal text. Why is this? - Sid |
Quote:
|
Quote:
HTML Code:
<? require_once('/forums/global.php'); ?> |
No, I thought you said it showed the lirterals. I took that to mean the actual colour codes for alt1 and alt2.
The page view you showed tells me that you have not made the file a .php as I suggested earlier. To interpret it as PHP, it needs to be a PHP extension. :) |
Quote:
The source of the PHP file if viewed after being parsed shows up as follows: PHP Code:
PHP Code:
- Sid |
the page must be save as .php page, .html page won't work.
|
Quote:
PHP Code:
PHP Code:
PHP Code:
- Sid |
Sid, this may be a problem of not including global.php You are including it, but the path may be wrong, as it will depend on where your test.php file exist. Try running it in your main forum home first, and remove that '/forum/' directory from the path.
|
Quote:
Code:
Critical Error - Sid If I move it into the same folder as global.php it suddenly works! I think I'll just leave it there! Thank you very much for your help. But, for future reference, can you explain to me why this is happening? Should I change that line to a relative path? [php]<? require_once('../global.php'); ?>- Sid |
Quote:
|
Quote:
- Sid |
All times are GMT. The time now is 09:56 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|