...

View Full Version : Days of week are not populating correctly



Errica
07-11-2007, 04:09 AM
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:


$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:


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

mlseim
07-11-2007, 04:22 AM
what happens if you change this:

if(count($attr) > 1) {

to

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


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

Errica
07-11-2007, 04:28 AM
what happens if you change this:

if(count($attr) > 1) {

to

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

Doesn't work. Anything else I can try?

StupidRalph
07-11-2007, 06:08 AM
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?

Errica
07-11-2007, 02:03 PM
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??

StupidRalph
08-05-2007, 05:44 AM
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?


for($i = 0; $i < 3; $i++) {



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum