can someone help me with the php code needed to make a customized availability calendar token? i need more flexibility in where the availability calendar is placed in the room type node page.

Comments

willvincent’s picture

I don't know whether that could really be done properly with tokens

I suppose one could create a token that had a format like [avail-mm-yy] that would be replaced with a calendar for that month of that year.. but I'm not sure whether that's a good solution or not.

What specifically are you trying to accomplish?

Looking at your site, I assume you'd like to get rid of the 3 month display thats showing up below your tabbed section for each rental?

If that's the case, the best solution might just be a theme preprocess function, if you're not able to theme the page so the calendars show up as you'd like.

I am curious how you managed to get both a 12 month display in a tab and the 3 month display below the tabbed section. Are you explicitly calling the function to build the list of calendars within that tabbed section? If you're doing that you could probably uncheck the "Display on node page" checkbox in the uc_hotel settings to turn off the others, or set the number of months to display to 0

clevername’s picture

the 3 month display below my tabbed section was just temporarily turned on while I was messing with the site yesterday.
in the tabbed section, i used a dynamic field with the php code

$themecal=hotel_calendars_node($node, $year = 2009, $month = 12, $monthstodisplay = 12);
return '<fieldset>' .$themecal. '</fieldset>';

this was my workaround to give me more flexibility with where the avail calendar was placed on the page.
the problem is that I have to manually adjust the $month = xx portion every month to keep the display updated. im sure there is an easy fix, but my skills and patience are limited at this point. and im sure others would appreciate some flexibility with where the avail calendar is placed on the page.

thanks again.
Newport Beach Vacation Rentals

willvincent’s picture

Well, if you're calling the function directly, you could just feed it with current values like this:

instead of $year = 2009, $year = date("Y", time())

and instead of $month = 12, $month = date("n", time())

clevername’s picture

perfect. any thoughts on adding flexibility to where the body/avail calendar is placed on the page for future versions? should i leave this issue open as a feature request?

willvincent’s picture

Status: Active » Fixed

A lot of the display elements will be moved into theme functions and templates in the future, so that will solve this issue. It's already in the works.

willvincent’s picture

Status: Fixed » Closed (fixed)