SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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/...ss_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
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  2. #2
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

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

    Thanks
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  3. #3
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  4. #4
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 Code:
    <?php
    $courses 
    Course::selectByCurrentWeek('fitness');

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

    $nextweek $addweek;
    $prevweek = -$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 Code:
    <?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
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy

  5. #5
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to show you what i echo out:

    PHP Code:
    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
    Software Engineer ASP, ASP.NET, VB, PHP

    Kind regards
    Billy


Bookmarks

Posting Permissions

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