Topic: Default day and years span.

Hi,

Have just installed LuxCal Web Calendar and so far it's working as expected. Thanks!
However, my requirements are just a little bit different and maybe require some mods, no problem if I need to change some PHP code.
At first glance LuxCal seems to default to the current day, but for a history site I need to default the Calendar to June 15, 1842 within a span of 7 years, that is 1839 to 1845. Is that possible?

Thanks.

Re: Default day and years span.

Hi Les,

Have you considered the following:
You can add "?cD=1842-06-15" to the calendar URL. This will bring you to the date specified in ISO format. So in this case June 15, 1842

I can also send you a very simple PHP code change to set the default date to a fixed date in the past.
If you often need to change the default date within the span you specified in your post above, then maybe a date input field should be added to the admin's Settings page. This is a bit more work, but still not very much.

So please let me know what you need and then we will take it from there.

Roel

3 (edited by lesm 2019-08-05 02:57:31)

Re: Default day and years span.

Hi Roel,
Thanks for the tip. I'll be glad to make the necessary mods to change the default date only within the span, hence the code change to set the default date to a fixed date is enough.

Appreciated.
lesm

Re: Default day and years span.

Hi Lesm,

Edit the file 'index.php' in the calendar root and change line 243 from . . .

if (empty($_SESSION[$calID]['cD'])) { $_SESSION[$calID]['cD'] = $today; } //empty: today

to . . .

if (empty($_SESSION[$calID]['cD'])) { $_SESSION[$calID]['cD'] = '1842-06-15'; }

. . . to go to June 15, 1842 for example.

Note: If on the admin's Settings page, in the section User Accounts, "Restore last user selections has been checked, the The "next" default page will be the last selected page.

This is the "fixed" solution. Do you want the option to set the date on the admin's Settings page?
If so, I will do it for you, because explaining what to do is as much work as doing it wink

Roel

Re: Default day and years span.

Great Roel!
It works just fine. Really it is okay for me but if you wish send the code for the admin's Settings page mod  you are welcome.
Thanks a lot.
lesm

Re: Default day and years span.

Roel wrote:

Hi Lesm,

Edit the file 'index.php' in the calendar root and change line 243 from . . .

if (empty($_SESSION[$calID]['cD'])) { $_SESSION[$calID]['cD'] = $today; } //empty: today

to . . .

if (empty($_SESSION[$calID]['cD'])) { $_SESSION[$calID]['cD'] = '1842-06-15'; }

. . . to go to June 15, 1842 for example.

Note: If on the admin's Settings page, in the section User Accounts, "Restore last user selections has been checked, the The "next" default page will be the last selected page.

This is the "fixed" solution. Do you want the option to set the date on the admin's Settings page?
If so, I will do it for you, because explaining what to do is as much work as doing it wink

Roel

At index.php I also replaced:

 $today = date('Y-m-d');

by:

 $today = date('1842-06-15');

Yet I'm not sure if this affects other parts of the code.