Event block issue when there are no events to display
Permalink
Hi There
On my pages in my sidebar i have the following code
<?php
$block = Block::getByName('Event');
$block->display();
?>
which displays a banner to the next event in the calendar.
My issue is when there are no published events it displays a fallback banner -- for an event on the 1 January 1970..
In none of my templates is this hardcoded -- only the above code is..
Is it possible then that this "1 January 1970" is being fetched from the database?
And should this :: be a clue to me?
Sorry I'm still gaining understanding of php.
Many Thanks
On my pages in my sidebar i have the following code
<?php
$block = Block::getByName('Event');
$block->display();
?>
which displays a banner to the next event in the calendar.
My issue is when there are no published events it displays a fallback banner -- for an event on the 1 January 1970..
In none of my templates is this hardcoded -- only the above code is..
Is it possible then that this "1 January 1970" is being fetched from the database?
And should this :: be a clue to me?
Sorry I'm still gaining understanding of php.
Many Thanks
When your database query returns 0 or NULL that is what will display. Usually it's 12/31/1969 but it depends on your timezone and settings.
Hi Hutman - thanks for responding.
So that date is a db entry..
I dont have access to to the db server but is it it possible then to hide this block in the event that the query returns a null - using php?
Thanks for ur help.
So that date is a db entry..
I dont have access to to the db server but is it it possible then to hide this block in the event that the query returns a null - using php?
Thanks for ur help.
You would have to change the block's view file to check if there is a value coming back and if not don't display anything.
Thanks Hutman
Will do.
Will do.