1 silencer Jul 07, 2008 12:52
3 silencer Jul 07, 2008 18:06
Hi,
Thanks for the feedback.
Does this mean that I have to change the stylesheet file format from stylesheet.css to a stylesheet.php file which I would then call in the _body_header.inc.php and _html_header.inc.php, using your code:
<link rel="stylesheet" href="lunarstyle.php" type="text/css" />
The new stylesheet.php would then start with the new header and contain the php code for randomization.
Wouldn't that mean that I have to change all files calling the stylesheet.css?
Regards,
Silencer
4 silencer Jul 07, 2008 18:14
Sometimes writing things down is a big help. I now manage to call the banner file but having some trouble with the index. My banners are called banner1.jpg, banner2.jpg etc. but the file returned is only called banner.jpg
Any ideas?
Thanks,
Silencer
5 silencer Jul 07, 2008 18:34
Of course this cannot work ;-)
It's gotta be:
<?php $random = rand( 1, 3);
$randomimg = 'header' . $random . '.png';
?>
The only thing left are some ugly borders around my image but this time I have no idea how to solve this.
BTW: good feeling that I can still do a little little bit of coding stuff...
6 afwas Jul 07, 2008 18:57
Looks like that works just fine on your blog.
Of course my code had some errors. Note to self: test before you post.
Well done.
--F
7 yabba Jul 07, 2008 19:16
Unless you want to use $randomimg in more than one place in the code then you could save a few cpu cyles, a tad of memory and some hdd space with :
#headerimg {
background: transparent url('img/header<?php echo rand(1,3); ?>.png') no-repeat center 15px;
margin: 0;
height: 180px;
*width: 100%;
}
¥
8 silencer Jul 08, 2008 10:22
Not a bad solution either, thanks. :)
I'll solve the graphics border problem using some color transitions, that should be fine.
Thanks all, you've been of great help again. Now I just need so solve my [url=http://forums.b2evolution.net/profile.php?mode=viewprofile&u=2002]archives problem[/url]. :)
I do believe what you want is possible, but I'm not 100% sure.
I achieved similar effect by switching images in the stylesheet. I call the stylesheet as php file
I start the phpstylesheet by sending the correct header:
And now I can use php within the stylesheet.
I described this technique in a blog article: http://www.blog.hemminga.net/index.php/B2evo/2007/12/02/conditional-css-through-php but since I didn't invent it, you could also Google for more ideas.
Good luck