Jump to content

Active / inactive Class with date function


Joepiooo1988

Recommended Posts

Hi all,

 

Recently, I have spent time on making an active / inactive class for a CMS system that I am making with a friend. Works fine now but now suddenly we were thinking of making a function to add that you can enter a date that he becomes active. So I want a text that will be active tomorrow. When I set the date to 25-05-2012 it will be active on that date.

 

Now I honestly do not exactly know where to start and finding a good tutorial for something similar is hard. Does anyone can help me out a bit with this?

 

thanks

 

Joep

Link to comment
Share on other sites

How are you currently getting classes that are inactive / active - is it just a switch (on|off, 0|1 etc?). You'll need to added a "publish_date" or "activate_date" column to the table your store your data in. (Or create a table and join the two together).

 

When creating a class, add in the publish_date to each entry. Then when pulling data from the database, make sure that the publish_date is > NOW(). Hopefully a good starting point, it's more simple than you may first imagine.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.