|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Theme changer
I got two css style sheets, one is green the other one dark-purple.
Now i was thinking that every 12 hours, themes would switch from green (7 am) to purple at 7pm. Could this be done with cronjobs, how? If so with php maybe if else but i think that'd be a little too complex no? |
|
#2
|
||||
|
||||
|
with cronjob you could change the filename,
e.g. you have style1.css and style2.css. At 7 am style1.css would then be renamed to style2.css and style2.css would become style1.css. your code should then only refer to style1.css but i would do it in php, less complicated and is easier to see what is happening. some seudo code could be Code:
if (time between 7 am. and 7 pm) then use green.css else use purple.css end if try take a look at the time function. |
|
#3
|
|||
|
|||
|
I know that but now i realise i want to use crontabs just to get to know it
i used it to run scripts but not to rename a filename. How?I could execute a php file that changes the name of 2 files, but that wouldn't be the same ![]()
__________________
Like my post? Rep me ! services@mathiaskeulen.be - Custom scripting at high quality and webdesign Current special offers: -PM script and Member scripts Deviner ~ M : Webdesigner and Webdevelopper Last edited by fangore : June 14th, 2008 at 06:32 AM. |
|
#4
|
||||
|
||||
|
Quote:
Just write two shell scripts; one that links stylesheet.cs and purple.cs at 7pm, and another that links stylesheet.cs and green.cs at 7am. Both of these scripts should be one liners, and you already know how to run a script from cron .Note: you don't have to use links, you can just copy the appropaite file to the stylesheet.cs if you wish. Take care, Mark. |
|
#5
|
|||
|
|||
|
What command can i use to just rename a directory? In crontab?
Thank you. |
|
#6
|
||||
|
||||
|
Quote:
I'd go for: Code:
mv source target http://www.indiana.edu/~uitspubs/b017/ Mark. |
|
#7
|
|||
|
|||
|
Thank you very much
![]() mv style1.css style3.css then mv style2.css style1.css ? Last edited by fangore : June 18th, 2008 at 11:25 AM. |
|
#8
|
||||
|
||||
|
Quote:
It takes 3 steps to swap two files in place. This can be written inline like so. Code:
mv style1.css temp.css; mv style2.css style1.css; mv temp.css style2.css Mark. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Theme changer |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|