Page 1 of 1

Next / Prev Links

PostPosted: Thu Apr 24, 2008 9:20 pm
by sftl99
I just downloaded this today and I love it. Thank you for your hard work.

I was wondering if there is an easy way to add links to easily go to next month or previous month. I would only want to display one month and just be able to go forward and back one month.

If this is an easy feature, is it doable via AJAX so that I can have the calendar embedded in a page and be able to go to the next month without reloading the page?

Re: Next / Prev Links

PostPosted: Thu Apr 24, 2008 9:35 pm
by chris
Hi there and welcome to the forum :)
I'm glad you like the script and hope that it will be of some use to you.

You may well have searched the forum, but just in case here is a thread that talks through how to add a select box (or links) to be able to jump to the next or previous months.

I realise that what you are really after is an ajax solution - I was wondering how long it would take someone to request that :) This would clearly be the ideal addition to this script (seeing as it is based on the use of ajax anyway) so I will try to add the function and explain the steps to take. However it is not something that I will be able to do immediately as I have rather a lot of work on at the moment and this would require quite a bit of time, so please be patient. If I come up with something I will post it here so you should be the first to know ;)

Chris

Re: Next / Prev Links

PostPosted: Thu Apr 24, 2008 10:05 pm
by sftl99
I had seen this thread but it was a bit more developed than what I needed, plus I was looking for links instead of form actions...which I suppose wouldn't be that difficult.

Thanks for the tip, though...this is something I can definitely live without so no pressure at all.

Re: Next / Prev Links

PostPosted: Thu Apr 24, 2008 10:19 pm
by chris
the link version are at the end of that post:
Code: Select all
<a href="calendar.php?id_item=<?php echo ID_ITEM; ?>&year_month=<?php echo $last_year_start; ?>-<?php echo $last_month_start; ?>">prev</a>
<a href="calendar.php?id_item=<?php echo ID_ITEM; ?>&year_month=<?php echo $next_year_start; ?>-<?php echo $next_month_start; ?>">next</a>

to only display one month, you just alter the MONTHS_TO_SHOW constant at the beginning of the code.

:)

Chris