Displaying only 6 month out of 12 each year

Help with installation and general calendar setttings

Displaying only 6 month out of 12 each year

Postby lolycatz » Mon Oct 18, 2010 6:53 pm

Hi Chris
Congrats for this calendar which really is neat and usefull by the way I have been looking for such a component and it just fits my need beautifully.

I was wondering if it would be possible to alter the php code to only show 6 months on the calendar for each year - specifically May to October - this is for a B&B which is closed in the winter season and this will save a lot of time ınstead of having to tick everyday from October to April as unavailable.
I would appreciate your help if this is feasible - :mrgreen: (My fıngers too)
Cheers!
lolycatz
 
Posts: 2
Joined: Mon Oct 18, 2010 6:16 pm

Re: Displaying only 6 month out of 12 each year

Postby lolycatz » Mon Oct 18, 2010 7:04 pm

Or alternatively can we enter a code to say that each of the following months - November to April - show in a different color (darkred) while the other months show the regular available color (grey)?
lolycatz
 
Posts: 2
Joined: Mon Oct 18, 2010 6:16 pm

Re: Displaying only 6 month out of 12 each year

Postby chris » Tue Oct 19, 2010 8:55 pm

Hi, sorry for the delay in answering. For some reason some posts don't get sent to my email so I miss them :(
only show 6 months on the calendar for each year - specifically May to October

To do this I think that you would need to do 3 things:

1. In admin set the calendar to show 3 months.

2. Update the php code to always start the initial load on the 5th month of the year.
To do this open the ac-includes > cal.inc.php file.
FInd this line (80):
Code: Select all
$this_month = (!isset($_GET["month"])) ? date('m') : $_GET["month"];

and change it to this:
Code: Select all
$this_month = 5;


3. Finally modify the JavaScript so that rather than advancing each month by the number of months defined in admin, it always moves it forward by 12 months.
This is actually very simple to do and requires no JavasScript knowledge.
In the main index.php file (if you are using the iframe method to integrate your calendar this is the file that you are using) and find the following code within the JavaScript variables definitions block (line 23?):
Code: Select all
var months_to_show      = <?php echo AC_NUM_MONTHS; ?>; // number of months to show

and change it to this:
Code: Select all
var months_to_show      = 12; // number of months to show

As I am sure you will be able to see from that change, we are simply telling it to load each month 12 months into the future.

That is all you need to do.
Have a go at that and let me know how it goes or if you need any further help.

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

Re: Displaying only 6 month out of 12 each year

Postby adam68s » Thu Feb 23, 2012 7:05 pm

Hi,

i have exactly the same needs - to display only months from May to October but i have 1 problem - i cannot find this lines under 2.

chris wrote:2. Update the php code to always start the initial load on the 5th month of the year.
To do this open the ac-includes > cal.inc.php file.
FInd this line (80):
Code: Select all
$this_month = (!isset($_GET["month"])) ? date('m') : $_GET["month"];

and change it to this:
Code: Select all
$this_month = 5;



Maybe is problem in different version of script? Any suggestions how to do this in latest scrip version?

Thx,
Adam
adam68s
 
Posts: 2
Joined: Thu Feb 23, 2012 6:56 pm

Re: Displaying only 6 month out of 12 each year

Postby chris » Thu Feb 23, 2012 7:26 pm

Hi Adam, you are right.
In the latest version the line to change (in the same file) is line 80:

Code: Select all
$this_month = date('m');   # current month


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

Re: Displaying only 6 month out of 12 each year

Postby adam68s » Thu Feb 23, 2012 7:38 pm

THX Chris!! :)

Now is working perfectly!!!
adam68s
 
Posts: 2
Joined: Thu Feb 23, 2012 6:56 pm

Re: Displaying only 6 month out of 12 each year

Postby pewe » Thu Apr 12, 2012 4:40 pm

Chris,

These mods do not appear to be the same for the latest version.

Would you be so kind as to confirm what mods would be required (for example to only show 3 months June/July/August for each year - ie selecting next moths would go to 2013).

Many thanks

Sorry - was half asleep - didn't see the above :oops:
pewe
 
Posts: 13
Joined: Tue Mar 08, 2011 2:02 am


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron