Jump to content


Photo

how to create a dynamic calenda


  • Please log in to reply
1 reply to this topic

#1 Sebastiangperez

Sebastiangperez
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 April 2006 - 05:16 PM

dear PHPhreaks

How i can create a dynamic calendar , that i can put dates on a database, and then show into the calendar whit another colors , like a booking hotel system , i want to make by my self .. i need a little help ..
best regards.

Sebastian

msm:sebastiangperez@hotmail.com


#2 djnrempel

djnrempel
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 04 April 2006 - 05:31 PM

[!--quoteo(post=361609:date=Apr 4 2006, 12:16 PM:name=Sebastiangperez)--][div class=\'quotetop\']QUOTE(Sebastiangperez @ Apr 4 2006, 12:16 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
dear PHPhreaks

How i can create a dynamic calendar , that i can put dates on a database, and then show into the calendar whit another colors , like a booking hotel system , i want to make by my self .. i need a little help ..
best regards.

Sebastian

msm:sebastiangperez@hotmail.com
[/quote]

Umm, that's a pretty broad request. I suggest you start working on one (or search through script archives) and then post here as you need help solving individual problems. That's how I learned PHP, function by function as I tackled different problems.

In broad terms, you will need to design what it should look like, create a script that will generate that, and then build the parts that will read data from users, add it to the database, and then display search results. I have a script that displays a calendar of the last 31 days, if that helps - see it in action at [a href=\"http://frood.net/comics/\" target=\"_blank\"]http://frood.net/comics/[/a]

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$blankdays= strval(date("w", tt('30')));
$emptycells="";
$x=0;
while ($x<$blankdays):
$x++;
$emptycells .= '<td> </td>';
endwhile;

echo '
<table border="1" cellpadding ="3">
<tr><th>Sun.</th><th>Mon.</th><th>Tue.</th><th>Wed.</th><th>Thu.</th><th>Fri.</th><th>Sat</th></tr>
<tr>'.$emptycells;

$x=31;
while ($x>0):
$x--;
$month=date("M", tt($x));
$weekday=date("D", tt($x));
$numdate=date("j", tt($x));
$break=''; if ($weekday=="Sat") $break="</tr>\n<tr>";
$style='""'; if ($weekday=="Sun") $style='"font-weight:bold;"';
echo "date("n/j", tt($x))."</td>$break ";
endwhile;
$blankdays= 7-(strval(date("w", tt(0))));
$emptycells="";
$x=1;
while ($x<$blankdays):
$x++;
$emptycells .= '<td> </td>';
endwhile;
echo $emptycells.'</tr></table>';[/quote]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users