Jump to content

how to create a dynamic calenda


Sebastiangperez

Recommended Posts

[!--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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.