Joepiooo1988 Posted May 24, 2012 Share Posted May 24, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/263045-active-inactive-class-with-date-function/ Share on other sites More sharing options...
theverychap Posted May 24, 2012 Share Posted May 24, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/263045-active-inactive-class-with-date-function/#findComment-1348244 Share on other sites More sharing options...
Joepiooo1988 Posted May 24, 2012 Author Share Posted May 24, 2012 Yes active = 1 and inactive = 0... Ok, so I have to create a new table like "text_publish_date" in my database? Quote Link to comment https://forums.phpfreaks.com/topic/263045-active-inactive-class-with-date-function/#findComment-1348267 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.