HowDoIGetCalenderToMove

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

  1. JackT06 macrumors 6502

    JackT06

    Joined:
    Jul 24, 2009
    #1
    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.
    Code:
    <h2>Calendar</h2>
    					<div id="calendar_wrap">
    						<table summary="Calendar">
    							<caption>
    							August 2009
    							</caption>
    							<thead>
    								<tr>
    									<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>
    								</tr>
    							</thead>
    							<tfoot>
    								<tr>
    									<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>
    								</tr>
    							</tfoot>
    							<tbody>
    								<tr>
    									<td>1</td>
    									<td>2</td>
    									<td>3</td>
    									<td>4</td>
    									<td>5</td>
    									<tdid="today">6</td>
    									<td>7</td>
    								</tr>
    								<tr>
    									<td>8</td>
    									<td>9</td>
    									<td>10</td>
    									<td>11</td>
    									<td>12</td>
    									<td>13</td>
    									<td>14</td>
    								</tr>
    								<tr>
    									<td>15</td>
    									<td>16</td>
    									<td>17</td>
    									<td>18</td>
    									<td>19</td>
    									<td>20</td>
    									<td>21</td>
    								</tr>
    								<tr>
    									<td>22</td>
    									<td>23</td>
    									<td>24</td>
    									<td>25</td>
    									<td>26</td>
    									<td>27</td>
    									<td>28</td>
    								</tr>
    								<tr>
    									<td>29</td>
    									<td>30</td>
    									<td>31</td>
    									<td class="pad" colspan="4"> </td>
    								</tr>
    							</tbody>
    						</table>
    					</div>
    Here is a picture of what it looks like : [​IMG]
     
  2. Cerebrus' Maw macrumors 6502

    Joined:
    Mar 9, 2008
    Location:
    Brisbane, Australia
    #2
    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

    web_god61

    Joined:
    May 14, 2004
  4. JackT06 thread starter macrumors 6502

    JackT06

    Joined:
    Jul 24, 2009
    #4


    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?

    Thanks
     
  5. Joined:
    Jun 30, 2009
    #5
    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).


    *
    Code:
    <?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