Discussion in 'Web Design and Development' started by JackT06, Aug 6, 2009.

  1. JackT06 macrumors 6502


    Jul 24, 2009
    Does anyone know how to code a calendar? (i want the number to move along so people know what date it is)
    I have got on which came with a template but it doesnt change the day over for me which is a pain.
    					<div id="calendar_wrap">
    						<table summary="Calendar">
    							August 2009
    									<th abbr="Monday" scope="col" title="Monday">M</th>
    									<th abbr="Tuesday" scope="col" title="Tuesday">T</th>
    									<th abbr="Wednesday" scope="col" title="Wednesday">W</th>
    									<th abbr="Thursday" scope="col" title="Thursday">T</th>
    									<th abbr="Friday" scope="col" title="Friday">F</th>
    									<th abbr="Saturday" scope="col" title="Saturday">S</th>
    									<th abbr="Sunday" scope="col" title="Sunday">S</th>
    									<td abbr="July" colspan="3" id="prev"><a href="#" title="View posts for July 2009">« July</a></td>
    									<td class="pad"> </td>
    									<td colspan="3" id="next"> </td>
    									<td class="pad" colspan="4"> </td>
    Here is a picture of what it looks like : [​IMG]
  2. Cerebrus' Maw macrumors 6502

    Mar 9, 2008
    Brisbane, Australia
    You are using pure html, which is a static markup language.
    You will need a scripting language to dynamically update your page every time someone accesses it.

    If your looking at serverside language (the server decides the time and date) you could use the PHP date() function. Problem with this is that if you have users from different time zones, they will only see the current time of where your server is located. There are ways around this, however.

    Or you could use a client sided language, such as Javascript, which also has a date function, similiar to the php one. This is handy as it uses the browsers date and time, where ever it is set. Of course, if the user has messed up their own clock, this also might not be reliable.
  3. web_god61 macrumors regular


    May 14, 2004
  4. JackT06 thread starter macrumors 6502


    Jul 24, 2009

    Have You Ever Used This Before?

    Because i can save the file as php but then how do i link my html pages to it?

  5. Joined:
    Jun 30, 2009
    You're not linking anything. Say you've got your nice *.htm web page, which does not include this calendar. You simply insert the code for the calendar you want (the one which also highlights the date is * ), and then save the *.htm page (say index.htm) to *.php (say index.php). Upload the new file to the web server (say you're using MAMP locally: /Applications/MAMP/htdocs), AND run the page in your browser (say you're using MAMP locally: http://localhost:8888/index.php).

    $time = time();
    $today = date('j',$time);
    $days = array($today=>array(NULL,NULL,'<span style="color: red; font-weight: bold; font-size: larger; text-decoration: blink;">'.$today.'</span>'));
    echo generate_calendar(date('Y', $time), date('n', $time), $days);

Share This Page