Show next previous months in smaller iterations

Help with installation and general calendar setttings

Show next previous months in smaller iterations

Postby Neil » Sun Nov 07, 2010 3:45 am

Hi Chris
Trawled through the forum but couldn't see anything on this, which probably means its so straight forward I should be able to do it :)
My calendar is a six month display, but I want to alter the number of months the next / previous buttons increments by a lesser amount rather than the previous / next six months.
E.g. Display shows 6 months - Feb to July, but when pressing NEXT I want to display July to December rather than August to January, so there is an overlap of one month (July), this is purely cosmetic but would preserve viewing continuity(?).
E.g. Display shows 6 months - Feb to July, but when pressing PREVIOUS I want to display September to February rather than August to January, so there is an overlap of one month (February), this is purely cosmetic but would preserve viewing continuity(?).
Is this feasible (like changing 'next6' to 'next6'-1 sort of thing) or is it too complicated to warrant the effort?
Thanks Neil

.
Neil
 
Posts: 4
Joined: Sat Oct 09, 2010 1:51 pm

Re: Show next previous months in smaller iterations

Postby chris » Sun Nov 07, 2010 9:32 pm

Hi,
Yes this is feasible and actually very simple.
All you need to do is change the JavaScript variable "months_to_show" in the calendar "index.php" file from it's default php constant AC_NUM_MONTHS to a numeric value such as, in your case, 5.

So this:
Code: Select all
var months_to_show   = <?php echo AC_NUM_MONTHS; ?>;

becomes this:
Code: Select all
var months_to_show   = 5;


Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Show next previous months in smaller iterations

Postby Neil » Mon Nov 08, 2010 9:41 pm

Excellent!
Many thanks Chris for your usual prompt response!
Where / how can I alter the $numMonths showing 'Next x months' tooltip.
currently being returned from the lang file(?) to reflect the new smaller iteration, without changing the actual number of months being displayed?
Neil
 
Posts: 4
Joined: Sat Oct 09, 2010 1:51 pm

Re: Show next previous months in smaller iterations

Postby chris » Mon Nov 08, 2010 10:08 pm

Glad to be able to help :)

Where / how can I alter the $numMonths showing 'Next x months' tooltip.


If you are just using one language I suggest that you simply hardcode the title tag directly in the page.
Look for these lines in the same file that you just modified and change the '.$lang["prev_X_months"].' bit to whatever you want the tip to show.
Code: Select all
<div id="cal_prev" title="'.$lang["prev_X_months"].'"><img src="'.AC_DIR_IMAGES.'icon_prev.gif" class="cal_button"></div>
<div id="cal_next" title="'.$lang["next_X_months"].'"><img src="'.AC_DIR_IMAGES.'icon_next.gif" class="cal_button"></div>


Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: Show next previous months in smaller iterations

Postby ztc » Sat Mar 12, 2011 2:07 pm

Code: Select all
var months_to_show   = <?php echo AC_NUM_MONTHS; ?>;

Changing the variable months_to_show to a numeric value doesn't have any result on my page. Even after changing it the page displays as many calendars as i configured in the admin panel. What am I doing wrong?
ztc
 
Posts: 2
Joined: Fri Mar 11, 2011 11:51 pm

Re: Show next previous months in smaller iterations

Postby chris » Mon Mar 14, 2011 11:47 am

Hi,
You are right, this doesn't work. (I wonder why I ever thought it did?)

You need to make the following changes:

1. In the calendar/index.php file add this line at the top of the page (after the opening php tags and before the cal.inc.php file is included);
Code: Select all
define("AC_NUM_MONTHS",7);


2. In the ac-includes/common.inc.php file find this line (ln 42):
Code: Select all
define("AC_NUM_MONTHS", "".$row_config["num_months"]."");

and change it to this:
Code: Select all
if(!defined("AC_NUM_MONTHS"))   { define("AC_NUM_MONTHS","".$row_config["num_months"]."");}

This last line will be used by the admin panel (which doesn't use the main index.php file) to get the default number of months.

I hope that works OK - let me know how it goes.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest