Today in history idea

5 posts by 3 authors in: Forums > CMS Builder
Last Post: June 20, 2016   (RSS)

By Jesus - June 9, 2016

Hi,

I'm creating a table where I'm putting a lot of historic events in order to create a today in history widget for my website. I've a few questions and I hope to get some advice from you.

1. Which date format should I use?

2. Does any one knows how can I create the query based on the date I used (on step 1) to display just one random historic event per day (of course each one of this will be always for today)

3. On the widget, I'll get a link so people will be able to see all the historic events for the day in course.

I hope I was clear enough in order to be able to create this functionality for CMSB

Thanks in advance for your help!

Jesus

By Damon - June 10, 2016

Hi Jesus,

There will be some custom coding to create a widget that randomly shows events from today in history.

Here is the rough overview of what is needed:

  1. Table of historic events in CMS Builder. For the date format you will need the month, day and year. The year isn't going to be as important as you will only be checking for matching month and day.
  2. Get the current date month and day using PHP. Add those into variables you can pass into a where query.
  3. Use a where query in your load records code to only return records that have a date (month and day) that match today (month and day).
  4. Randomize the results: 
    'orderBy' => 'RAND()',
  5. Limit the random results to returning just one record:
    'limit' => '1',

How does this sounds?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Toledoh - June 16, 2016

Hey Jesus.

It may be worth reviewing http://www.interactivetools.com/forum/forum-posts.php?Opening-Hours-80581 as I think it could help you.

Cheers,

Tim (toledoh.com.au)

By Jesus - June 20, 2016

Thank you pal, will give this a try!

Jesus