I've managed to cobble together a site that changes colours and backgrounds whenever the page loads. I've done this by combining CSS and PHP together.
This was in response to a recent poster who enquired about a means of organising a large website that would require fairly regular changes in colours and styles depending on the seasons/holidays. A few people commented at the time, that this kind of project might prove to be a bit of a nightmare to organise.
Anyway, this is my solution. I've used a random number generator in this prototype, but, I think, a PHP date function would work equally well.
I'd be interested to know what you think of this approach to this kind of task.
Other than the fact that
Other than the fact that your green background image doesn't tile properly a very well-executed page. Very handy and very well written and explained
Thanks for your feedback,
Thanks for your feedback, Pineapplehead.
I think the green background you mentioned does tile, but is just hideously ugly. It was the last one I made, and i was running out of energy at that stage. A new background is on my list of tasks for this weekend.
Yes that is a really good
Yes that is a really good page you made. simple but effective, though the colours are quite high contrast...
Thanks mihir. I built it as
I built it as an experiment, but yeah the colours have turned out to be the aspect that are most problematic. I'm trying to work on an algorhythm that will render readable text, but with less contrast. It's usually at this point my brain feels like it might explode.
If anyone has got any ideas or insight regarding this I would be very grateful.
One thing makes me curious.
One thing makes me curious. PHP can automatically get date and time from the server can it not? So therefore, using your technique, would it not be possible to have, say for example, a day time colour during the day, and a moon-lit effect at night... or perhaps leaves in the background come Autumn but falling snow come winter...
What I like about these ideas is the idea your site would effectively be living, but with 0 input from you outside the initial background designs and various CSS files. Of course the downside would be the updating of all CSS files with the various backdrops each time a minor change was made to one of them.
OOOh, unless they were background specific references only, and all imported a general CSS file.
I'm getting quite excited over this. This would be possible right? (If so, it will be a feature of Burlster.com)
Hi John, Yeah, my first
Yeah, my first version used two stylesheets. The first with all the main attributes and, the second, which shifted colour and layout (switching a sidebar from left to right). Here's a link if you are interested.
I liked the idea, but the code bagan to get a bit cumbersome. The site I posted to the forum is version two and the code is much much lighter. I've also built a calendar site, that changes the text and images every day by using PHP.
I'm really digging the interaction between CSS and PHP.
Yeah sure, By reading in
By reading in the dates and times and what not, you can then calculate which CSS file should be used do it that way!
I have also enjoyed the interaction between CSS and PHP. I think something I'm working on at the moment does it to a degree. Each page is given a name and a category. Then PHP then says 'if it's such-and-such a category, write this line'. The line it writes is CSS that slots in to the HTML overwriting a 'hidden' sub-menu and highlighting the page your on. With nothing more then a page identifier in CSS, I can create an interactive drop down menu (albeit not the clever sort. If it drops down, it does so taking the rest of the menu with it...)
I agree that it would work
I agree that it would work great if we could do something like that. but if that site is gonna be managed by a client, it would really be a lot of explaining. Phreestyle i am ready to contribute, but after the 20th... am off on a jungle trek now.
A jungle trek sounds pretty
A jungle trek sounds pretty cool. Lucky you.
If you have a spare moment maybe you could try to find a way to make 16 million colours conform to a ratio of 5:1 (as set out in the W3C guidelines) when neither the 5 or the 1 are known entities.
Enjoy your trek. Hope you see some cool butterflies.
Hi, i am finally back from
i am finally back from the trip, with some good photographs and a lot of travelling. Anyways, taking a hint from your project i have taken it a further and added a colour picker, to it. I have also made it such that it once the form is submitted, the input fields have that colour.
I am making it as a component, but i will put it up on one of the test servers for you to see.
I am working on it currently on my local server and it will be a couple of days to put it up. As i mentioned i have just taken a hint from your idea, what i am working is something different,
i wont disclose it now... but will post the link in a couple of days.
Good project!!! I'll
I'll bookmark the page for later reference.
mihir, Those are nice
Those are nice photographs. i'm glad your trek went well. You could build a cool butterfly related site using your photographs.
I'll be very interested to see your PHP switching ideas in action. They sound very interesting.
thanks. I hope you can find a use for some of the ideas.