PDA

View Full Version : loop in custom pages


CraiovaOnLine
05-11-2008, 09:42 AM
hello,

i made a custom page for a weather script.
inside that code i have a foreach for displaying results for 5 days.
the code is somethin like this:

foreach ($index[day] as $day){
if ($values[$day][attributes][t] != ""){
$row_color = "#FFFFFF";
[ ... code code code .. a lot of code ]

echo "<tr><td class=\"alt1\">$day</td>
<td class=\"alt2\"><img align=\"middle\" border=\"0\" src=\"http://site.com/sdk/$image_size/$imag.png\" alt=\"\" />$cond</td>
<td class=\"alt1\">$min_max</td>
<td class=\"alt2\">$sunrise_sunset</td>
<td class=\"alt1\">$precip</td>
<td class=\"alt2\">$humid</td>
<td class=\"alt1\">$wspeed</td></tr>";

$counter++;
$row_counter++;
}
}

how to export that echo?

Thanks!

Dismounted
05-11-2008, 12:26 PM
Append it to a variable, and use that in your template.

CraiovaOnLine
05-11-2008, 03:58 PM
it wont work.
it will display just the 5th day.

//later
damn. i'm stupid :))
i did it. it works fine