SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can jQuery be used to automatically post and remove content based on date?

    What is the best way to automatically post and remove content to a website based on date?

    For instance... i have an upcoming event box on my homepage... instead of manually updating the box a few times a month... is it possible to use a bit of jQuery to automatically post the latest upcoming event... when the events' date expires... i would like the next upcoming event to automatically take its place.

    ideas?

    fyi - my site is a static html5 website. i am open for other suggestions as well. thanks.

  2. #2
    SitePoint Member Knight Yoshi's Avatar
    Join Date
    May 2012
    Location
    Tampa, Florida, United States
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It will not save the file, jQuery is just a JavaScript library. JavaScript is client side. You should probably use a CMS, which would make updating the page easier, since you would be able to use a nice graphics interface.

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,684
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Tussy View Post
    What is the best way to automatically post and remove content to a website based on date?

    For instance... i have an upcoming event box on my homepage... instead of manually updating the box a few times a month... is it possible to use a bit of jQuery to automatically post the latest upcoming event... when the events' date expires... i would like the next upcoming event to automatically take its place.

    ideas?

    fyi - my site is a static html5 website. i am open for other suggestions as well. thanks.
    You could have a data file, that you populate with events, so that scripting can then use the JSON protocol to read in that data and do things based on it.

    Code json:
    {
        "events":[
            {
                "event":"Event 1",
                "date":"3/20/2013"
            },
            {
                "event":"Event 2",
                "date":"3/30/2013"
            },
            {
                "event":"Event 3",
                "date":"4/6/2013"
            }
        ]
    }

    You could then easily have javascript read in that json data, and loop through the events looking for the most recent upcoming event.

    That way, it is only the contents of that data file that would need to be edited, which is a simple way of doing things.
    Last edited by paul_wilkins; Mar 25, 2013 at 17:47.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

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