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:
- 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.
- Get the current date month and day using PHP. Add those into variables you can pass into a where query.
- 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).
- Randomize the results:
'orderBy' => 'RAND()', - Limit the random results to returning just one record:
'limit' => '1',
How does this sounds?
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By Jesus - June 10, 2016
Like a great idea, will start working on this. Will let you know how it goes
Thanks!
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.
Tim (toledoh.com.au)