Results 1 to 2 of 2

Thread: NOOB Q?=adding events to my php calendar??

  1. #1
    Join Date
    Jan 2010
    Posts
    93

    NOOB Q?=adding events to my php calendar??

    i am continuing to work on this calendar as i am learning so much from studting and mastering each step.. now i would like to add some events. I am NOT wanting to use java or anything else for now, i know this really limits me but i am trying to get php down really well before i move on to java etc.. so, my question is is there another way to link to an event on a particular day other than just linking to a new page to display the events for each day using just php?? i know it could be done alot more professionally with java but as i said i am wanting to learn php for now. ty in advance. i am really starting to get this.. thanx to all of you guys helping me out, and the tutorials i am doing.
    also, this calendar script is an "included" file in my index.php file
    here's my script so far:

    PHP Code:
     ini_set('date.timezone''America/Indianapolis');

    $date time();

    $day date('j'$date);  
    $month date('m'$date);  
    $year date('Y'$date);  

    if (isset(
    $_COOKIE["month"])){
    $month $_COOKIE["month"];
    }

    if(isset(
    $COOKIE["year"])){
    $year $_COOKIE["year"];
    }

    $nexty $year;
    $nextm $month+1;
    if(
    $nextm >12){
    $nextm 1;
    $nexty $year+1;
    }

    $prevy$year;
    $prevm$month -1;
    if(
    $prevm <1){
    $prevm 12;
    $prevy $year-1;
    }



    $first_day mktime(0,0,0,$month1$year);  

    $title date('F'$first_day);   

    $day_of_week date('D'$first_day);

    switch(
    $day_of_week){
    case 
    "Sun"$blank0; break;
    case 
    "Mon"$blank1; break;
    case 
    "Tue"$blank2; break;
    case 
    "Wed"$blank3; break;
    case 
    "Thu"$blank4; break;
    case 
    "Fri"$blank5; break;
    case 
    "Sat"$blank6; break;
    }        

    $days_in_month cal_days_in_month(0$month$year);


    echo 
    "<div id =\"calendar\"><table border= \"0\" width= \"300\" height= \"250\">";

    echo 
    "<tr>
    <td colspan=\"1\">
    <a href=\"cal_cook.php?m=
    $prevm&y=$prevy\"><<</a></td>
    <td colspan= \"5\" id=\"calhead\">
    $title $year</td>
    <td colspan= \"1\"><a href=\"cal_cook.php?m=
    $nextm&y=$nexty\">>></a></td>
    </tr>"
    ;    

    echo 
    "<tr>
    <td width= \"42\">S</td>
    <td width= \"42\">M</td>
    <td width= \"42\">T</td>
    <td width= \"42\">W</td>
    <td width= \"42\">T</td>
    <td width= \"42\">F</td>
    <td width= \"42\">S</td>
          </tr>"
    ;

    $day_count 1;

    while(
    $blank 0){
    echo 
    "<td>&nbsp;</td>";
    $blank $blank -1;
    $day_count++;
    }
          
    $day_num 1;

    while(
    $day_num <= $days_in_month){
    if(
    $day==$day_num){
    echo 
    "<td><span style= \"font-weight:bold; color:#ff0000;\">$day_num</span></td>";
    }
    else{
    echo 
    "<td>$day_num</td>";
    }
    $day_num++;
    $day_count++;
      
        if(
    $day_count 7){
         echo 
    "</tr><tr>";
         
    $day_count=1;
        }
             
    }

        


    while(
    $day_count >&& $day_count <=7)
    {
    echo 
    "<td>&nbsp;</td>";
    $day_count++;
    }    

    echo 
    "</tr></table></div>"

  2. #2
    Join Date
    May 2009
    Location
    England
    Posts
    165
    Hi fuston05,

    You need to understand that PHP is a *server* side language which means that all processing must be done at the server by request - ie a link in this case.

    When you move on to JavaScript (I assume you meant JS not Java?) you'll start to unravel AJAX which is the technology you want to implement in order to have seamless calendar (think Google Calendar).

    Also, just one note in passing: I would use $_SESSION variables rather than $_COOKIE variables.

    I hope that helps and good luck with the project.

    Regards,


    David
    David McLeary
    Emerging Innovations
    Website Development, Training and Consultancy

Similar Threads

  1. noob question, how to: php mailer
    By google in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 18 Jul 2009, 08:26 PM
  2. PHP Calendar (YES, NO, MAYBE Votes)
    By Brent K in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 03 Apr 2009, 01:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •