Change Layout According Day And Night

Started on the old forum in February 2009 · view the original in the archive · old links redirect here

25 replies · 1,816 views · started 17 years ago · 1 min read

TL;DR · summary of 25 replies
  • users can change themes not all sites can do that.
  • djlee suggested a one-line solution for changing day and night layouts without errors.
  • storing CSS files in PHP could be used for efficient storage and caching to reduce load times.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

12 participants
tkrocks Junior · 39 posts #1

CODE<? $hour = date(”H”); if ($hour > 9 || $hour < 18) { include('daycss.css'); } elseif ($hour > 18 || $hour < 9) { include('nightcss.css'); } else { echo "Error!"; } ?>

u can accordingly add your stuff ......for ex if u want sun in the morning u can put the background image of the sunn.....at the night u can do it with a image of a moon...!!!!!!!!!!!!!!!!!!! thanks ......only for u my brother farhad may your soul rest in peace ...................

I WAS BORNED INTELLIGENT BUT EDUCATION RUINED ME...!!!

ori Lead · 512 posts #2

interesting idea but what bout sites where users make there own themes?

tkrocks Junior · 39 posts #3

QUOTE (ori @ Feb 21 2009, 03:14 PM) <{POST_SNAPBACK}>

interesting idea but what bout sites where users make there own themes? hmmmmm dint get ya ...cn u post the site were ppl make their own theme

I WAS BORNED INTELLIGENT BUT EDUCATION RUINED ME...!!!

subzero Super moderator Fellow · 3,954 posts #4

My site users can change themes not all sites can do that ..

But i got a error lol

this didnt wont to work for me

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

djlee Developer · 224 posts #6

bad idea .. else error ??? theres no reason for the else to be called true .. but why risk it .. simple method in one line ...

include((date("H") > 18 && date("H") < 9 ? "night" : "day").".css");

1 line so its cleaner and if date fails for whatever reason the else param is called and the day.css file is included .. this way the site will always work and no error messages

Guest #8

QUOTE (ori @ Feb 22 2009, 06:43 AM) <{POST_SNAPBACK}>

thats alot of options u dnt reali need lol should make it bit neater

lol yeah.. thats not for everybody, just the geeky ones use it, others use default themes.. 😀 Ppl mess it up pretty easily, if they dont know what they're doing..

amylee Principal · 1,092 posts #9

this is how i edit themes External image (may be gone)

currently only admin can do it once i get time and hopefully with another new script users can fully edit anything regarding a theme background images, text effects etc etc the lot hopefully

djlee Developer · 224 posts #10

ive actually been working on a new css based theme system.. hears a few ideas ive been playing with that might help you

  1. What about storing an entire CSS file in a text/Blob field, u cud use blob for a quick and easy way to store the css file or use a serialised string in a text field which you can the parse into a basic css file for inclusion

  2. Once you have a more efficient way of storing it, what about load times.. everyone knows the best way to lower load times is with caching .. so lets cache the css. Personally id have an unlimited time cache, and only update the cached file when the user updates the css (you could directly update teh cache, or delete the cached file and on next page load a new css will be generated)

  3. So we have a prety efficient system. But i hate uneeded data in a database. especially since i make any site i create easily scaleable. So maybe we could rip out all the stored css files and store them independantly. Its easy to parse information from a file, if your not good with regex then have a serialised string commented at the top of the css file. so when a users comes to edit the css settings, u read from that string using explode or something. much easier way of doing it

so we have a css file that doesnt rely on the database, a theme engine which doesnt require table lookups on every page load, a way to save the css file and a way to edit the file. Then all u need is a way of checking for a valid file, so thats just a conditional statement in the head tags of the document.

$uid = 1; // example i dunno what u use for user ids

if(file_exists("cache/usrcss/$uid.css"))
 echo "<link rel='stylesheet' type='text/css' href='cache/usrcss/$uid.css' />";
else
 echo "<link rel='stylesheet' type='text/css' href='default.css' />";

simple bit of code and thats a nice, semi optimised theme engine that is far more scalable than the current theme engines your using (ive only seen 3 sites theme engines however but since the owners are idiots, im guessing its some default copy and paste theme code since the screenprints above look similar to theirs)

anyway just a few ideas i jotted down, it could be optimised further and be made for complex for a truely unique engine but i aint giving away all my ideas 🙂

wap2k Developer · 168 posts #11

Had this idea same idea but haven't implemented anything in wapside yet will be doing soon

ori Lead · 512 posts #12

who was the creator of wapside?

oh and heres how i do my themes users can create there own thru database thee is only 1 theme file i wont give my css code or how it interacts with the database but heres how to get it started make a php file call it style.php and add this

<?php
header("Content-type: text/css");
header("Cache-Control: no-cache, must-revalidate");
require('modules/db.php');
$uid=$_GET["uid"];
$bgcolor=users_table("bgcolor",$uid);
$txtcolor=users_table("txtcolor",$uid);
$linkcolor=users_table("linkcolor",$uid);
$stylishcolor=users_table("stylishcolor",$uid);
$navcolor=users_table("navcolor",$uid);
$font=users_table("font",$uid);
if(empty($bgcolor))$bgcolor="fff";
if(empty($txtcolor))$txtcolor="000";
if(empty($linkcolor))$linkcolor="3366ff";
if(empty($stylishcolor))$stylishcolor="4a4839";
if(empty($navcolor))$navcolor="3366ff";
if(empty($font))$font="medium";
?>

body {background-color:#<?=$bgcolor?>; color:#<?=$txtcolor?>; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:<?=$font?>; margin:0px; padding:2px;}

#etc etc jus add ur codes and use <?=$ and the php bits as defined above its quite easy

code for html/xhtml

<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.php?uid=$uid\"/>
subzero Super moderator Fellow · 3,954 posts #13

Wap2k is loll

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

GumSlone Administrator Principal · 1,690 posts #15

There are several ready to use css parser classes at phpclasses.org which make it easy to edit and create new css files.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

ori Lead · 512 posts #16

another plus to having ur css file in php is that no1 can get the link thru source and see ur css code so its safe no1 will see how u did ur css

wap2k Developer · 168 posts #17

Yes they can if the classes generate CSS files from user input.

something else Fellow · 2,296 posts #18

QUOTE (ori @ Feb 21 2009, 09:44 AM) <{POST_SNAPBACK}>

interesting idea but what bout sites where users make there own themes?

Not exactly hard to do??????

QUOTE (ori @ Feb 23 2009, 08:51 AM) <{POST_SNAPBACK}>

who was the creator of wapside?

oh and heres how i do my themes users can create there own thru database thee is only 1 theme file i wont give my css code or how it interacts with the database but heres how to get it started make a php file call it style.php and add this

<?php
header("Content-type: text/css");
header("Cache-Control: no-cache, must-revalidate");
require('modules/db.php');
$uid=$_GET["uid"];
$bgcolor=users_table("bgcolor",$uid);
$txtcolor=users_table("txtcolor",$uid);
$linkcolor=users_table("linkcolor",$uid);
$stylishcolor=users_table("stylishcolor",$uid);
$navcolor=users_table("navcolor",$uid);
$font=users_table("font",$uid);
if(empty($bgcolor))$bgcolor="fff";
if(empty($txtcolor))$txtcolor="000";
if(empty($linkcolor))$linkcolor="3366ff";
if(empty($stylishcolor))$stylishcolor="4a4839";
if(empty($navcolor))$navcolor="3366ff";
if(empty($font))$font="medium";
?>

body {background-color:#<?=$bgcolor?>; color:#<?=$txtcolor?>; font-family:Verdana,Arial,Helvetica,sans-serif; font-size:<?=$font?>; margin:0px; padding:2px;}

#etc etc jus add ur codes and use <?=$ and the php bits as defined above its quite easy

code for html/xhtml

<link rel=\"stylesheet\" type=\"text/css\" href=\"/style.php?uid=$uid\"/>

..........................

if(isday($time)){
$file ="day";
}else{
$file ="night";
}
$css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/$filestyle.php?uid=$uid\"/>";
ori Lead · 512 posts #19

users dnt generate css files theres 1 php file that has the css code in it and jus gets the colors from what users hav saved thru database hav look at the code i posted its all there lol

ori Lead · 512 posts #20

QUOTE (something else @ Feb 24 2009, 02:46 AM) <{POST_SNAPBACK}>

Not exactly hard to do??????

..........................

if(isday($time)){
$file ="day";
}else{
$file ="night";
}
$css = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/$filestyle.php?uid=$uid\"/>";

was pointing out that day/night themes isnt exactly useful when users make there own theme onsite lol

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close