Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    252
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Unhappy Days of week are not populating correctly

    I'm attempting to display information for today, the next day and the day after (so only three days worth).

    The first day is hardcoded to say now. I want the next day and the day after to be the abbreviated day (ie. Tue, Wed and so on).

    The problem I have with the following code is that now and the next day are the same. Thus, I have now (which is Tue), the next day (which is ALSO Tues - wrong!) and the day after is Wed (you guessed it...wrong!).

    Someone please help me fix this

    Here's the include:

    PHP Code:
    $return['mydata'] = array();
            for(
    $i 0$i 2$i++) {
                
    $attr explode('"'$this->tag('blm:mydata',$i));
                if(
    count($attr) > 1) {
                    
    $day = array();
                    
    $day['when'] = $attr[1];
                    
    $day['image'] = IMAGES.$this->translate($attr[11]).'.gif';
                    
    array_push($return['mydata'], $day);
                }
            }
            return 
    $return
    And here's the front-end page:

    PHP Code:
    echo "\t\t\t".$stuff['mydata'][0]['when']."<br/>\n";
    echo 
    "\t\t\t".$stuff['mydata'][1]['when']."<br/>\n"

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    what happens if you change this:

    if(count($attr) > 1) {

    to

    if(count($attr) >= 1) {


    (I'm just stabbing in the dark here, sorry).

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    252
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mlseim View Post
    what happens if you change this:

    if(count($attr) > 1) {

    to

    if(count($attr) >= 1) {
    Doesn't work. Anything else I can try?

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    PHP Code:
    echo "\t\t\t".$stuff['mydata'][1]['when']."<br/>\n";
    echo 
    "\t\t\t".$stuff['mydata'][2]['when']."<br/>\n"
    Can't you increment the index?
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    Regular Coder
    Join Date
    Aug 2005
    Posts
    252
    Thanks
    23
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by StupidRalph View Post
    PHP Code:
    echo "\t\t\t".$stuff['mydata'][1]['when']."<br/>\n";
    echo 
    "\t\t\t".$stuff['mydata'][2]['when']."<br/>\n"
    Can't you increment the index?

    That actually works for the next day but it leaves the day after blank. Any ideas??

  • #6
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    Hi Errica, I was just going thru old threads and seen that I've left this accidently hanging. Did you resolve this issue?

    Did you try increasing your for loop variable to 3? What does that do?
    PHP Code:
    for($i 0$i 3$i++) { 
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.


  •  

    Posting Permissions

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