Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 14th, 2008, 03:44 AM
fangore fangore is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 127 fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 11 h 34 m 14 sec
Reputation Power: 5
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?

Reply With Quote
  #2  
Old June 14th, 2008, 05:39 AM
MrFujin's Avatar
MrFujin MrFujin is offline
Lord of the Dance
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2003
Posts: 1,273 MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level)MrFujin User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 2 h 59 m 56 sec
Reputation Power: 342
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.

Reply With Quote
  #3  
Old June 14th, 2008, 06:14 AM
fangore fangore is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 127 fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 11 h 34 m 14 sec
Reputation Power: 5
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.

Reply With Quote
  #4  
Old June 14th, 2008, 08:18 PM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 3 m 4 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally Posted by fangore
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


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.
__________________
programming language development: www.netytan.com Hula


Reply With Quote
  #5  
Old June 18th, 2008, 10:32 AM
fangore fangore is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 127 fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 11 h 34 m 14 sec
Reputation Power: 5
What command can i use to just rename a directory? In crontab? Thank you.

Reply With Quote
  #6  
Old June 18th, 2008, 11:03 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 3 m 4 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally Posted by fangore
What command can i use to just rename a directory? In crontab? Thank you.


I'd go for:

Code:
mv source target


http://www.indiana.edu/~uitspubs/b017/

Mark.

Reply With Quote
  #7  
Old June 18th, 2008, 11:22 AM
fangore fangore is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2007
Posts: 127 fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level)fangore User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 11 h 34 m 14 sec
Reputation Power: 5
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.

Reply With Quote
  #8  
Old June 18th, 2008, 11:52 AM
netytan's Avatar
netytan netytan is offline
Hello World :)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2003
Location: Hull, UK
Posts: 2,536 netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level)netytan User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 18 h 3 m 4 sec
Reputation Power: 63
Send a message via ICQ to netytan Send a message via AIM to netytan Send a message via MSN to netytan Send a message via Yahoo to netytan
Quote:
Originally Posted by fangore
Thank you very much
mv style1.css style3.css
then
mv style2.css style1.css
?



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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Theme changer


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT