How can i build this calendar style page functionality

Hey,

I am trying to work out what the best way is to implement something that will involve in my opinion a lot of work.

Take a look at this image:

http://www.glofamily.com/glo/images/05_fitness_courses.jpg

Now what i need to do is show a series of “Fitness Courses” that are available for customers throughout the year on specific days. What i need to do is have the currency week commencing showing at the top, and then show each day of the week followed by a fitness course which is occurring on a specific day.

So first question is, how can i go about starting to build this?

Second question is in the admin section, how could i manage this in the best possible way?

Any advice/examples would be much appreciated…

Thanks again

Just to show you what i echo out:


wc <?=$week?>

But it’s not doing it properly… If you view the page and click on the next/previous links you will see what happens, it jumps 2 months whereas it should be in weeks…

What am i doing wrong?

Thanks again

Hey,

Thanks Anthony, i have done the admin section as i thought i could get it out of the way. I am basically inserting fitness courses which have a specific date. Now the date is inserted into the database, which now works fine.

If you look at this page: http://www.glofamily.com/glo/fitness-courses/

You will see it says wc June 2010

Now i need this to say wc May 31st 2010

I have the following code in my page:#


<?php
$courses = Course::selectByCurrentWeek('fitness');

if(isset($_GET['week'])){
    $addweek = $_GET['week'];
}
else{
    $addweek = 0;
}

$nextweek = 7 + $addweek;
$prevweek = -7 + $addweek;

$week = mysql_fetch_array(Course::getWeek());
$week = $week['week'];
$week = strtotime($week);
$week = date("F Y",$week);
?>   

And i use the following methods, i have put these together but am aware that these might be totally the wrong way of doing it…


<?php

class Course{

    public function selectByCurrentWeek($catID){

        if(isset($_GET['week'])){
            $week = $_GET['week'];
        }else{
            $week = 0;
        }
        $sql = "SELECT *
                FROM tbl_courses e
                WHERE WEEK(date) = WEEK(CURRENT_DATE) + $week
                AND catID = '$catID'
                AND deleted = 0
                ORDER BY date ASC";
        $result = mysql_query($sql);
        return $result;
    }

    public function getWeek(){

        if(isset($_GET['week'])){
            $week = $_GET['week'];
        }else{
            $week = 0;
        }
        $sql = "SELECT DATE_ADD(CURRENT_DATE, INTERVAL $week WEEK) as week
                FROM tbl_courses e";
        $result = mysql_query($sql);
        return $result;
    }
}

Can you see what i am doing wrong?

I need to display the week commencing date as shown above…

Any ideas?

Thanks

Where are you upto?

Store some dummy data in your database, then work out how to get the data out you need first.

event
-id
-name
-start (datetime)
-end (datetime)

As for the current week, just pass it in the url and use it in your SQL query.

Once you have the returning as required, start on the admin interface, treat it as a completely separate job.

Hey,

Has anyone got any ideas as to how i can do something like this?

Thanks