layout questions

layout questions

Postby julian » Thu Feb 28, 2008 10:29 pm

hello Chris!
Thank you very much for the calendar script!
it's the best solution i've ever seen!

but there are still some questions:
+ why did you choose images for the days? is it possible to replace them by text and change the cell's background to red when checked?
+ is it possible to make the month-boxes' height equal?

i am a php newbie ;)

thank you very much
julian
julian
 
Posts: 1
Joined: Thu Feb 28, 2008 9:38 pm

Re: layout questions

Postby chris » Fri Feb 29, 2008 4:07 pm

Hi there and thanks for the comments.

I used images for various reasons though clearly it wouldn't be too hard to adapt the script (with javascript) to use text.
Clearly images have the downside of taking a little while to load, however I felt that this made the calendar more "personalizable" and also easier to click on. It also allows for more calendar states rather that just "available" and "booked" such as morning and afternoon booking - take a look at this thread for more comments: viewtopic.php?f=9&t=8
I am currently working on the script that I mention in that thread and hopefully I will be able to make it "public" this weekend (though you can download the current version from the link in that thread)
I will include in this new version the modification to make the months the same height ;)

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

Re: layout questions

Postby aquado » Sun Apr 20, 2008 11:37 pm

Hello Chris,

I've tried the modification you had left commented out to make the months the same height and after uncommenting the options I've received additional 6 rows in each box.

I made a change and repalced this part of code:
Code: Select all
echo "<br>".$cal_row_counter;
      for($i=$cal_row_counter; $i<6; $i++){
         $the_cal .= '<tr><td class="cal_empty" colspan="7"><img src="'.DIR_IMAGES.'/trans.png" height="20" width="10"></td></tr>';
      }


with this:
Code: Select all
echo "<br>".$cal_row_counter;
      for($i=$cal_row_counter; $i<6; $i++){
         $the_cal .= '<tr><td class="cal_empty" rowspan="7"><img src="'.DIR_IMAGES.'/trans.png" height="20" width="10"></td></tr>';
      }


This time I received additional single row but still in each month-box.
How can I manipulate it further to make number of rows in each month-boxes equal?

Aquado.
aquado
 
Posts: 11
Joined: Wed Apr 09, 2008 4:27 pm

Re: layout questions

Postby chris » Mon Apr 21, 2008 12:34 pm

Hi again ;)
I think that I left this this code commented out as I didn't finish it - I should have removed it from the zipped version, sorry :(

However, to get it working you really just need to add one line to start the calendar row counter before it the days are added.
Again, this line might be in the code commented out somwhere but I am not sure which version you are actually using (I am currently working on version 3 ;) )

So, within the draw_cal() function, add this line somewhere near the beggining (ie BEFORE we open the calendar table:
Code: Select all
$cal_row_counter=1;

Then, find the code that starts a new line ever 7 days:
Code: Select all
$week_day %= 7;
if($week_day == 0){
   $the_cal .= "</tr><tr>";
   ++$cal_row_counter;
}
$week_day++;

And check that you have the line ++$cal_row_counter; in there and uncommented.
Now the other bit of code "should" work were it adds rows up till 6.
You might find that there is a problem with the current month - this is caused by the css that gives it that border. You will need to modify the css or remove this detail.

I hope this works for you.

Chris
PS. now I have the code open I will try to sort out those week numbers for you....
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: layout questions

Postby aquado » Mon Apr 21, 2008 9:45 pm

It almost worked :!: :)
August and November are still stubborn and show 1 row less.
Moreover when I displayed 12 months at once I received this:

5
5
6
5
6
5
5
6
5
5
5
6

on the upper left side of my calendar site. It looks like the output from:
Code: Select all
$cal_row_counter


but I can't get rid of it :(

Aquado
aquado
 
Posts: 11
Joined: Wed Apr 09, 2008 4:27 pm

Re: layout questions

Postby chris » Wed Apr 23, 2008 12:17 pm

Hi,
Sorry, I started writing you a reply then got bogged down with trying to sort out the august month problem and forgot to send the reply :(

I haven't yet solved the row problem (now I remember why I left it commented out) but, in case you still have that list of numbers here's the reason.
You must have this line:
Code: Select all
echo "<br>".$cal_row_counter;
somewhere in the function - find and destroy!

I am going to have another go at the row problem now....

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

Re: layout questions

Postby chris » Wed Apr 23, 2008 12:53 pm

OK, I think that I have got the solution for the month rows :)

Keeping the changes that we made before, now find this code:
Code: Select all
if($week_day == 0) {
            $the_cal .= "</tr><tr>";
            ++$cal_row_counter;
         }

and replace with this:
Code: Select all
if( ($week_day == 0) && ($day_counter<$days_in_this_month )){
            $the_cal .= "</tr><tr>";
            ++$cal_row_counter;
         }

Simple, but effective ;)

I hope this sorts it out for you. Now back to adding the week numbers....
Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron