www.webdeveloper.com
Results 1 to 12 of 12

Thread: Theme Changer.. help? - Thanks in advance

  1. #1
    Join Date
    Sep 2009
    Posts
    7

    Arrow Theme Changer.. help? - Thanks in advance

    On my website i'm wanting the theme to change through different times throughout the year...

    I understand this can be done manually with asp.net or javascript which link to different css files, however i'm wondering if there is way there a way so it will switch the styles automatically?

    Thanks in advance,

    Haydn

  2. #2
    Join Date
    Jan 2009
    Posts
    3,346
    The two methods you described would be the automatic way. Opening the file and changing the CSS by hand would be the manual way.

  3. #3
    Join Date
    Sep 2009
    Posts
    7

    Arrow

    I understand what your saying, but how could it switch the css file at certain dates in the year without me touching the file?

  4. #4
    Join Date
    Jan 2009
    Posts
    3,346
    Any server side language can get the system date and determine which css file to load based on whatever periods of time you select. Javascript could also just as easily check the date on the client and pull the appropriate css file based on the date range you choose.

  5. #5
    Join Date
    Sep 2009
    Posts
    7

    Arrow

    Thanks for your help so far,

    Could you provide some kind of sample code just to give me an idea as i am quite new to this.

  6. #6
    Join Date
    Jan 2009
    Posts
    3,346
    For example in PHP:
    PHP Code:
    if(Date('n') > 9){ //between september and december
      //echo your CSS here
    } else if(Date('n') > 6){ //between june and september
      //echo your CSS here
    } else if(Date('n') > 3){ //between march and june
      //echo your CSS here
    } else { //between january and march
      //echo your CSS here

    I don't know how clear I can be since you haven't decided what language you wish to use to do it nor what the particulars are about your problem.

  7. #7
    Join Date
    Sep 2009
    Posts
    7

    Arrow

    Ok,

    I have a range of themes for different events in the year e.g. christmas, new year etc..

    I want it to change on specific date, or series of specific days. e.g. 25th, 30th, 31st.

    Could you write it in either javascript, asp or asp.net

    Thanks

  8. #8
    Join Date
    Jan 2009
    Posts
    3,346
    http://www.w3schools.com/jS/js_obj_date.asp

    Check out the site above and take a stab at it yourself...you are free to use the format for the logic I gave you above.

  9. #9
    Join Date
    Sep 2009
    Posts
    7

    Thumbs up

    Ok thanks,

    I'll let you know of any problems i have.

  10. #10
    Join Date
    Sep 2009
    Posts
    7

    Arrow

    I've had a crack at it and still cannot get my head round how to do it..

    Could you write a sample code in whatever code you find it easiest to write it in, thanks

  11. #11
    Join Date
    Jan 2009
    Posts
    3,346
    The code I posted above would work (with minor tweaks) for any C styled language (javascript, php, ASP.net, Java, etc). You just need to check for the specific dates first and get more general as you go along.

  12. #12
    Join Date
    Sep 2009
    Posts
    7
    I get what you mean, but i currently have no experience of any C styled language. Do you know anyone who could help, or if you could do it yourself.

    Thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles