Jump to content

Archived

This topic is now archived and is closed to further replies.

Sebastiangperez

how to create a dynamic calenda

Recommended Posts

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

Share this post


Link to post
Share on other sites
[!--quoteo(post=361609:date=Apr 4 2006, 12:16 PM:name=Sebastiangperez)--][div class=\'quotetop\']QUOTE(Sebastiangperez @ Apr 4 2006, 12:16 PM) [snapback]361609[/snapback][/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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.