+ Post New Thread
Results 1 to 6 of 6
Web Development Thread, Suggestions for displaying which.... in Coding and Web Development; We have recently moved to a 2 week timetable and I've been asked to display which week we are on ...
  1. #1

    rush_tech's Avatar
    Join Date
    Jul 2006
    Location
    Nottingham
    Posts
    1,415
    Thank Post
    111
    Thanked 265 Times in 201 Posts
    Rep Power
    194

    Suggestions for displaying which....

    We have recently moved to a 2 week timetable and I've been asked to display which week we are on the website. I could go through the calendar and add it to the beginning of each week but I wanted to ask if anyone else does this and if there is a different method.
    I'm using Joomla 1.5.24
    Thanks

  2. #2
    jamiess's Avatar
    Join Date
    Oct 2009
    Location
    Balsall Common
    Posts
    72
    Thank Post
    10
    Thanked 20 Times in 17 Posts
    Rep Power
    15
    This is possible with php the only problem is holidays and how your two week timetable handles these. Ill dig out the code if you want to have a play.

    Jamie

  3. Thanks to jamiess from:

    rush_tech (9th November 2011)

  4. #3

    rush_tech's Avatar
    Join Date
    Jul 2006
    Location
    Nottingham
    Posts
    1,415
    Thank Post
    111
    Thanked 265 Times in 201 Posts
    Rep Power
    194
    Cheers Jamie, if you don't mind I'll have a look

  5. #4
    jamiess's Avatar
    Join Date
    Oct 2009
    Location
    Balsall Common
    Posts
    72
    Thank Post
    10
    Thanked 20 Times in 17 Posts
    Rep Power
    15
    @rush_tech, i have sorted the code out for you however i wont be in the right office until Wednesday, ill uploaded it for as soon as i get in. Hope this is ok.

    Jamie

  6. #5

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,649
    Thank Post
    43
    Thanked 552 Times in 461 Posts
    Rep Power
    122
    If you use home access plus, you can ask it what week you are in. Using an iframe on your website, you can create a page in HAP+ say, ~/bookingsystem/weeknumber.aspx

    HTML Code:
    <%@ Page Language="C#" %>
    <%=new HAP.Data.BookingSystem.BookingSystem().DayNumber.ToString()%>
    or
    HTML Code:
    <%@ Page Language="C#" %>
    <%=new HAP.Data.BookingSystem.BookingSystem().WeekNumber.ToString()%>
    Day Number: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
    Week Number: 1, 2, 0 (0 = Holiday)

  7. #6
    jamiess's Avatar
    Join Date
    Oct 2009
    Location
    Balsall Common
    Posts
    72
    Thank Post
    10
    Thanked 20 Times in 17 Posts
    Rep Power
    15
    Here is the code to do this in PHP

    PHP Code:
    <?php 
    // set up an array
    $dates = array();
    //start date for the year
    $start_date "2011-09-05";
    //end date for the year
    $end_date "2012-07-21";
    //which week number to start on
    $num 1;

    while (
    $start_date <= $end_date) {
        
    // Split the given date down into day, month, and year
        
    list($yy,$ym,$yd) = explode('-'$start_date);
        
    // work out the week number
        
    $weeknum ltrim(date('W',mktime(0,0,0,$ym,$yd,$yy)), '0');
        
    // write it to the array
        
    $dates[$weeknum] = $num;
        
    // Ternary operator to alternate the week number
        
    $num = ($num == 1) ? 1;    
        
    // increase the start date by 7 days for the next week
        
    $start_date date('Y-m-d',mktime(0,0,0,$ym,$yd+7,$yy));
        }
    //print out the array for all the weeks in the year
    //print_r($dates);




    // work out modays date from todays date
    $date date('Y-m-d'mktime(0,0,0,date('m'), date('d')-date('w')+1date('Y')));
    //explode it 
    list($year,$month,$day) = explode('-'$date);
    //work out our week number
    $weeknum date('W',mktime(0,0,0,$month,$day,$year));
    //echo out the result
    echo "<p>This week is week "$dates[$weeknum] ."</p>";
    Hope this helps, Jamie

SHARE:
+ Post New Thread

Similar Threads

  1. Suggestions for EduGeek Cacti Guide
    By Geoff in forum Wireless Networks
    Replies: 18
    Last Post: 22nd May 2008, 04:24 PM
  2. Replies: 17
    Last Post: 9th May 2007, 02:39 PM
  3. Replies: 23
    Last Post: 19th May 2006, 11:32 AM
  4. Suggestions for a MCE 05 system & hardware?
    By tarquel in forum Hardware
    Replies: 12
    Last Post: 15th November 2005, 06:30 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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