business of the day rss help required please

4 posts by 3 authors in: Forums > CMS Builder
Last Post: January 10, 2019   (RSS)

By daniel - January 9, 2019

Hi willydoit,

As far as I'm aware, there's not strictly a way to get a PHP script to only "run" once per day; by its nature, it will execute every time it gets accessed. Instead what you'll need to do is store some information each day so you can produce a consistent result.

My recommendation would be to create a new CMSB section called "Business of the Day", which can store a business's num. Each time you access business-of-the-day.php, check if there's a record in this section that was created on today's date. If yes, retrieve the stored num and use it to get the data from the advertiser table. If no, select a random business and use that data, and also insert a record into the "Business of the Day" section to save the num.

Let me know if you have any questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By gkornbluth - January 9, 2019

Hi Willydoit,

Is it possible that using Daniel's approach triggered once a day by a cron job would be a direction worth exploring?

I've got a recipe in my CMSB Cookbook that uses a cron job to trigger the sending of emails if certain criteria are met.

It might easily be modified to do what you need.

http://www.thecmsbcookbook.com/recipedetail.php?SENDING-MEMBERSHIP-REMINDER-EMAILS-USING-A-CRON-JOB-471

Best,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By willydoit - January 10, 2019

Hi Jerry,

not being a programmer I have used the cookbook for a number of solutions over the years, I will take a look and see if it could be adapted by someone with my knowledge level which is pretty much cut and paste and hope for the best :-)