displaying tonights performing artist

18 posts by 7 authors in: Forums > CMS Builder
Last Post: February 24, 2012   (RSS)

By rez - June 11, 2009

Hello, I am in the middle of making a performance list of bands. I'm confident the list will come out as planned just like it is staticly on the site now:

June

Thurs, June 4- Mary & David Flood
Friday, June 5- Four Friends
Saturday, June 6- Four Friends
Thursday, June 11- Upstroke
Friday, June 12- Four Friends
Saturday, June 13- Francis Bridge Quartet
Thursday, June 18- Lizzie and Friend
Friday, June 19- Four Friends
Saturday, June 20- Four Friends
Thursday, June 25- Lizzie and friend
Friday, June 26- Francis Bridge Quartet
Saturday, June 27- Francis Bridge Quartet



In my performance schedule editor, i have a drop menu of bands from another table and a date filed. Pretty simple. What will be cool is displaying on the home page, Performing tonight: Thursday, June 11- Upstroke

But i have no idea how to code that. Something like:

If there is a band that matches todays date, echo it here. But if there isn't, don't display anything. (notice there aren't performances every night.) So how do you check todays date and see if there is an entry in my databse and display it? Probably pretty simple :) but i didnt find anything here.

Re: [rez] displaying tonights performing artist

By ross - June 12, 2009

Hi there.

Thanks for posting!

There are probably several ways to do this but the first one I thought of was to use an IF statement. Try something like this:

<?php if (date("D, M jS", strtotime($record['date'])) == date("D, M jS")): ?>
ALL YOUR CODE GOES HERE
<?php endif ?>


That should get you going. The only thing is $record['date'] might be different for you. That's the name of the field for date.

Give this a shot and let me know what you think :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [ross] displaying tonights performing artist

By rez - March 6, 2010 - edited: March 6, 2010

Hello,

any way of displaying tonights artist plus the next 4 upcoming artists or more?

The idea is that i want to show the next 4 or so but not one that the date has already passed (without having to delete entries or manually move things)

Re: [gkornbluth] displaying tonights performing artist

By rez - March 7, 2010 - edited: March 7, 2010

Thanks for that. I did find this since my question:

http://www.interactivetools.com/iforum/Products_C2/CMS_Builder_F35/gforum.cgi?post=76332;search_string=show%20today;t=search_engine#76332

but you have cleared things up and have given me a lot of ideas. I guess I didnt need this when browsing through your cookbook and didnt remember that section.

Fun stuff. Thanks. :)

Re: [rez] displaying tonights performing artist

By gkornbluth - March 7, 2010

Thanks, and I'll look at the other post and include the idea in the Cookbook as well.

Best,

Jerry
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

Re: [gkornbluth] displaying tonights performing artist

By rez - March 7, 2010 - edited: March 8, 2010

I think you pretty much covered the other thread already. :)

I'm struggling with showing todays event until 2am which is when pubs close here. If someone checks the site at 12:30am, I need "todays" (I should call it "tonights")show to display until 2am.

this is wrong and missing the range but trying MySQL things like:

'where' => 'TIMESTAMP(CURDATE() - INTERVAL 1 DAY, "02:00:00")'

Then I want to list somewhere tonights show (until 2am + the next 31 days:

'where' => '(NOW() + INTERVAL 31 DAY) >= event_date AND event_date >= DATE_SUB(CURDATE(), -2 HOUR)',

any ideas?

Re: [rez] displaying tonights performing artist

By Damon - March 8, 2010

Have you considered using removeDate date field to set an expiry date and time for the event?

"Record won't be displayed on website after this date. This allows users to have content automatically "expire" from website after a certain date and time."

Let me know if that is an option and I can answer any questions.
Cheers,
Damon Edis - interactivetools.com

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

Re: [Damon] displaying tonights performing artist

By rez - March 8, 2010 - edited: March 8, 2010

I think it would be nicer if the user didnt have to specify 2 dates plus a time to remove.

Unless the user doesnt have to worry about the time to remove the show with removeDate. ? If the removeDate was show date 23:59:59 + 2 hours which would automatically remove tonights show after 2am. ?

I have no idea how to do that with removeDate but imagine it would be in the body of the page? I may have over complicated things and I'm pretty confused at this point. Currently, all my show dates are being removed at midnight and i dont know what to try next.

Re: [rez] displaying tonights performing artist

By Dave - March 8, 2010

Hi Rez,

That's a tricky one. How about this:
TIMESTAMP( DATE(NOW() - INTERVAL 2 HOUR) )

It gets the date for the time as of 2 hours ago, such as: 2010-03-08 00:00:00. So from midnight to 2 am it returns yesterdays date, and from 2am to midnight it returns todays date.

So you'd have:
'where' => " event_date >= TIMESTAMP( DATE(NOW() - INTERVAL 2 HOUR) ) ",

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com