Hello all, Im looking for some advice and suggestions. I have a job script and at present whenever a job is posted the job seekers who have opted in get an email. Obviously this means that if there are 10 jobs posted in one day then each user gets 10 emails. What I want to do is change this so that the user can choose 1 of 3 otions to have either daily weekly or monthly updates that would be sent on the morning of their chosen option. I have no idea the best way to go about designing this and wondered if anyone has done something similar and could offer some advice on how to do it? Im open to all suggestions. (im on a windows server if this means anything) Thanks Mike
just include ur script here to be modified .. it's very simple code but relaying on ur main script , because of variables names .. regards Almrshal
This is what I would do: - delete the code which send out email when a job is posted - make 3 cron jobs (daily, weekly and monthly) to replace the above
Totaly agree, although croning would be kinda hard job to corn tthis. If you could make a script that will let you do this by your own it would be better..
ok so I have come up with some Psuedo code in a kinda c++ style, can anyone help me convert it to php? thanks struct CategoryDesc { String Monthly String Weekly String Daily }; Map<String, CategoryDesc> CategoryStrings; /// first thing to do is populate the map with the correct strings // Get every job in the database < 30 days old for each job from the database { if( job.age < 1 day ) { /// get the item from the map so we can append a string might need to check it exists CategoryStings<job.category>->Daily += "\n" . job.shortstring } if( job.age < 7 day ) { /// get the item from the map so we can append a string might need to check it exists CategoryStings<job.category>->Weekly += "\n" . job.shortstring } if( job.age < 30 day ) { /// get the item from the map so we can append a string might need to check it exists CategoryStings<job.category>->Monthly += "\n" . job.shortstring } } // now that we have populated the map, we can search all users and email them for every user { String EmailString = "JIS email crap, job summary email intro crap" switch( user.subscriptiontype ) { case daily: EmailString + = "JIS Daily email\n" case weekly: EmailString + = "JIS Weekly email\n" case monthly: EmailString + = "JIS Monthly email\n" default : // they are not subscribed continue; /// skip this user, continue switches to the next for item... } for every category the user is subscribed too { EmailString += "Category : " . user.category . "\n====================\n"; switch( user.subscriptiontype ) { case daily: EmailString += CategoryStings<user.categorystring>->Daily case weekly: EmailString += CategoryStings<user.categorystring>->Weekly case monthly: EmailString += CategoryStings<user.categorystring>->Monthly default : // something is wrong if you get here } /// close up the email EmailSting += "please visit JIS for blah blah blah blah, thanks, the management.." SendEmail(to the user, with body "EmailString") } } Code (markup): It'll need to be associative arrays in php i think