funktioner bugger
HejJeg har et par funktioner der bugger.. eller?
function putInBox($contents) {
print("<table width=\"490\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>\n");
print("<td>\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>\n");
print("<td width=\"60\">\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>");
print("<td background=\"images/news_topminibox.gif\" width=\"20\" height=\"7\"></td>");
print("<td background=\"images/news_topminibox.gif\" width=\"20\" height=\"7\"></td>");
print("<td background=\"images/news_topminibox.gif\" width=\"20\" height=\"7\"></td>");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("<td background=\"images/news_topbigbox.gif\" height=\"7\">\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>\n");
print("<td width=\"*\"><img src=\"images/main_box_top_bg.jpg\" width=\"184\" height=\"7\"></td>");
print("<td width=\"50\"><img src=\"images/news_topdots.gif\" width=\"50\" height=\"7\"></td>");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td height=\"5\"></td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td>\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>\n");
print("<td class=\"fulltable\">\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"5\" cellpadding=\"5\">\n");
print("<tr>\n");
print("<td bgcolor=\"#1F2430\" valign=\"top\">\n");
print($contents);
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td height=\"7\">\n");
print("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n");
print("<tr>\n");
print("<td width=\"7\"><img src=\"images/news_bottomcurve.gif\" width=\"7\" height=\"7\"></td>");
print("<td background=\"images/news_bottombar.gif\" width=\"*\" class=\"right\"><img src=\"images/news_bottom_spare.gif\" width=\"1\" height=\"1\"></td>");
print("</tr>\n");
print("</table>\n");
print("</td>\n");
print("</tr>\n");
print("</table>\n");
print("<br>\n");
}
Denne funktion udskriver en "box" som jeg bruger til at have indhold i.
Den kaldes fx på en side via:
$contents = "noget indhold her osv";
putInBox($contents);
Dette virker fint nok..
Jeg prøver så at kalde en anden funktion:
function test() {
for ($l = 0; $l < 10; $l++) {
$contents = $l;
#første loop
return $contents;
}
#sidste loop
}
Blot en test funktion til at prøve putInBox(test());
Men! Når jeg kalder test() i putInBox(), så bliver det kun skrevet 1 gang. Hvis return $contents står under #første loop, så skriver den 0 ud, men står den under #sidste loop, skriver den 9 ud.
Det jeg vil have den til er at skrive 0-1-2-..-9 ud.
Hvad gør jeg forkert?