Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Navigation
Latest Addons
AD Gallery 37
SyntaxHighlighte... 47
Newsletters v4.03 105
Facebook Like Box 118
Newsletters v4.02 55
Metro 151
Facebook Connect 163
Shoutbox Panel 123
Redactor for PHP... 103
MI Floating Side... 105
Facebook Login/R... 147
Avatar Studio v2.03 177
Relationship Sta... 96
Sexual Orientati... 112
Fisherman 139
Popular Addons
iTheme2 5792
Arise 5783
User Control v1.23 4612
Event Calendar 4043
Photowidget panel 3880
Radio-Theme red2... 3347
Highslide Gallery 3309
CSS/JavaScript D... 3220
Facebook Connect... 2976
Dynamic Menu 2888
Slideshow Lightb... 2716
L-AMANT 2656
Enigma 2628
2Dark 2603
Black 2567
View Thread
Official Home of PHP-Fusion » General Addon and Modification Support » Ideas for Modifications and Requests
Who is here? 1 guest(s)
 Print Thread
dynamic css in header
robbieB
A script I'm trying to use to randomly rotate the background image in my site's header requires me to add the line:

echo "<style type='text/css' media='screen'> @import url('......[path ]....../dynamic_css.php');</style>\n";

between the <head> tags of the v7 header template. This works fine in Internet Explorer, but Firefox wont load the script from "dynamic_css.php" because it reads the MIME type as "text/html" not "text/css":

Error message: "The stylesheet "......[ path ]....../dynamic_css.php" was not loaded because its MIME type, "text/html", is not "text/css"."

The script includes a line which should tell the browser what type of file is being sent, but Firefox, Chrome, Safari, Opera etc. don't get the message:

// tell the browser what we're sending
header('Content-type: text/css');

I can get round this by declaring the style element twice, once inside the <head> tags and once outside. The random rotation script then works OK in all the browsers, but it screws up the page layout in Internet Explorer and also has a knock on effect on the CSS Dropdown Menu, which I also use (see www.rnsyc.net).

It's a case of "nearly but not quite", but I don't understand enough to see how to resolve it (except by waiting for Happy Svensson to include bg image rotation in the next version of his HappyAccidents theme :-)).

robbie
 
SimpleVision
please upload the code, which creates the problems
 
robbieB
SimpleVision wrote:
please upload the code, which creates the problems


www.thought-after...-rotation/
 
robbieB
robbieB wrote:
....... I can get round this by declaring the style element twice, once inside the <head> tags and once outside. The random rotation script then works OK in all the browsers, but it screws up the page layout in Internet Explorer and also has a knock on effect on the CSS Dropdown Menu, which I also use .....


An update for anyone interested. The problem with the layout in Internet Explorer just required some tweaking of the CSS Dropdown Menu. The other minor issue I've found was with the styles of the awec calendar infusion. In sum, the image rotation works but you can expect some minor knock-on problems with styles.

Even those minor issues may not arise if Firefox etc. could be got to load dynamic_css.php without having to declare the style element twice. Any suggestions as to how that might be done?

Thanks,

robbie

[Moderators: apologies but I first posted about this on the Themes forum (HappyAccidents theme). Maybe you'd prefer to move this thread over?]
Edited by robbieB on 17-01-2011 16:36
 
smokeman
Im not sure here - I've earliere made a little script that rotates the banner in the header. Is this what your looking for ?

The script will change banner each time the page is being refreshed/loaded.


Edit: Try to see if you can use this:

1. Create a folder called banners which will be located in the directory /images/

2. In this example we use 5 banners to be chosen randomly from.

Banners / logos must be called:

banner1.gif
banner2.gif
banner3.gif
banner4.gif
banner5.gif

- And they must be in /images/banners/ - you can also use the extension .jpg images instead. Then you just change from .gif to .jpg in the code that follows below.

3. Log on to the site and go to Administration->System->Banners - here insert the following little snippet in the field "Banner 1" or "Banner 2":
<?php
$logo = rand(1,5);
echo "<img src='http://www.phpfusion-tips.dk/images/bannere/banner$logo.gif' alt='0' border='0' />";
?>


- Change only the URL to your own site.

In this case we used 5 banners to be chosen randomly from. For further / less banners to choose from then you just change the number 5 in the code, corresponding to the number of banners to choose from.
Edited by smokeman on 17-01-2011 16:51
 
http://www.phpfusion-tips.dk/
robbieB
@smokeman

Thanks smokeman. Will try it.

robbie
 
smokeman
Oops - there was a small error in my code - when inserting it here in the forum, there was suddently some white/blank spaces that should'nt be there.

Please copy the code above again.
 
http://www.phpfusion-tips.dk/
robbieB
@smokeman

I'm using Keff's HappyAccidents theme, which handles the header in a different way, i.e. background image + siteintro.
So your very neat code for rotating a banner image will require some tweaking of the theme.

Thanks again for the tip.

robbie
 
smokeman
No Problem - hehe, you can't use it anyway though..
 
http://www.phpfusion-tips.dk/
robbieB
Grin

robbie
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
PHP-Fusion font for new header Themes Support 4 28-04-2013 04:50
Header appearance on different resolution screens Content Administration 9 25-04-2013 10:32
how to put image in TLC theme header ? Themes Support 2 14-04-2013 16:24
stylo news panel header color Themes Support 2 14-04-2013 14:04
change size header Themes Support 4 08-03-2013 06:03
Official Home of PHP-Fusion uses cookies. Some may already have been set. Read more about our Cookies here.
Please click the button I Consent Cookies to hide this bar and accept our cookies. If you continue to use the site with no action taken, we'll assume that you consent our cookies anyway.
Cookiebar Panel byVenue