Hej allesammen
Jeg har forsøgt at lave en slags "newsupdate-panel" på min side... Men der forkomme en mærklig fejl
Billed af "newsupdate-panel":
http://picasaweb.google.co.uk/cykelnyt/Hjemmeside/photo#5126122557335721666Nye medlemer, nye vidoer og nye foto's... Der er bare det problem at "nye videoer" og "nye foto's" gerne vi gå sammen derfor har jeg fået 3 ekstra (markeret med rødt) som jeg skal have væk.
Kodning:
Det er kodet i phpizabi-stil dvs. der er en html/tpl del og en php del
HTML
<tr>
<td><h2><br>Nye Videoer</h2></td>
</tr>
<tr>
<td valign="top" align="left" colspan="2"></td>
</tr>
<tr>
<td colspan="2">
<loop VInew>
<table width="90%" border="0" cellpadding="0" cellspacing="0" bgcolor="{new.rowcolor}">
<tr>
<td width="70" align="left" valign="top"><a href="?L=video.index&id={new.id}"><img src="http://img.youtube.com/vi/{new.videoid}/2.jpg" width="60" hspace="5" vspace="5" id="picture" /></a></td>
<td valign="top" style="padding:5px;"><a href="?L=video.index&id={new.id}">{new.title}</a><br />
Vist {new.views} gange <br />
</span> <img src="{themePath}/images/thumbsup/{new.avgrate}.gif" width="65" height="15" align="absmiddle"></td>
</tr>
</table>
</loop VInew>
<tr>
<td><h2><br>Nye Foto's</h2></td>
</tr>
<tr>
<td valign="top" align="left" colspan="2"></td>
</tr>
<tr>
<td colspan="2">
<loop FOnew>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="{new.rowcolor}">
<tr>
<td width="23%" align="left" valign="top" style="padding:5px;"><a href="?L=gallery.index&id={new.id}"><img src="system/image.php?file={event.mainpicture}&width=65"" alt="[Picture {150}]" align="top" id="picture" /></a></td>
<td width="77%" align="left" valign="top" style="padding:5px;"><a href="?L=gallery.index&id={new.id}">{new.title}</a><br />
<span id="small_text">Tilføet d. {new.date}<br />
Vist {new.views} gange - {new.rate} stemmer, </span> <img src="{themePath}/images/thumbsup/{new.avgrate}.gif" width="65" height="15" align="absmiddle"></td>
</tr>
</table>
</loop FOnew>
PHP
/* FIND LATEST VIDEOS */
$select = myQ("
SELECT *
FROM `[x]video`
WHERE `processed` = '1'
ORDER BY `date` DESC
LIMIT 3
");
$i=0;
while ($lastrow = myF($select)) {
$newArray[] = array(
"new.title" => $lastrow["title"],
"new.id" => $lastrow["id"],
"new.videoid" => $lastrow["videoid"],
"new.rowcolor" => ($i&1? $GLOBALS["OBJ"]["row_even"] : $GLOBALS["OBJ"]["row_odd"]),
"new.date2" => date($CONF["LOCALE_SHORT_DATE"], $lastrow["date"]),
"new.views" => $lastrow["views"],
"new.avgrate" => $lastrow["rating_avg"],
"new.rate" => $lastrow["rating_hits"]
);
$i++;
}
$tpl -> Loop("VInew", (is_array($newArray)? $newArray : array()));
/* FIND LATEST ARTICLES */
$select = myQ("
SELECT *
FROM `[x]gallery`
WHERE `processed` = '1'
ORDER BY `date` DESC
LIMIT 3
");
$i=0;
while ($lastrow = myF($select)) {
$newArray[] = array(
"new.title" => _fnc("strtrim", $lastrow["title"], 40),
"new.id" => $lastrow["id"],
"new.articleid" => $lastrow["articleid"],
"new.rowcolor" => ($i&1? $GLOBALS["OBJ"]["row_even"] : $GLOBALS["OBJ"]["row_odd"]),
"new.date" => date($CONF["LOCALE_SHORT_DATE"], $lastrow["date"]),
"new.views" => $lastrow["views"],
"new.avgrate" => $lastrow["rating_avg"],
"new.rate" => $lastrow["rating_hits"],
"event.mainpicture" => $lastrow["mainpicture"]
);
$i++;
}
$tpl -> Loop("FOnew", (is_array($newArray)? $newArray : array()));
Hvorfor får jeg 3 ekstra "kasser" ?
Og hvordan kan det fjernes?
Jeg er meget taknemmelig for dem, der vil prøve at hjælpe mig!!
MVH Allan