echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='496' height='250' alt='".$data['news_subject']."' title='".$data['news_subject']."' /></a> ";
width='496' height='250'
WHERE news_cat=11
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='38' height='30' alt='".$data['news_subject']."' title='".$data['news_subject']."' />"; }
$(currentImage).fadeOut(400, function() {
myTimer = setTimeout("showNext()", 4000);
Quote
Matonor wrote:
There is quite some duplicate code in there. Try using a loop (for/while/foreach) instead. Still good for your first one ;-)
Quote
Matonor wrote:
Take a look at this, it should do the same your script did except it does it with proper loop usage and thus less code. I didn't test it though, so there might be errors ;-)
[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]opentable($locale['featured001']);
echo "<table cellpadding='0' cellspacing='0' align='center'>\n<tr>\n<td>\n";
echo"<div id='wrapper'>";
$result=dbquery(
"SELECT * FROM ".$db_prefix."news ta ".
"WHERE news_cat=11 ORDER BY news_id DESC LIMIT 0,11");
if (dbrows($result)!= "0") {
$data = dbarray($result);
echo "<div id='bigPic'>";
echo " <a href='".FUSION_SELF."?readmore=".$data['news_id']."'>";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='496' height='250' alt='".$data['news_subject']."' title='".$data['news_subject']."' /></a> ";
echo "</div>";
echo "<ul id='thumbs'>";
$i=1;
while($data = dbarray($result)) {
echo "<li class='active' rel='".($i++)."' >";
echo " <img src='".IMAGES."news/".$data['news_image']."' border='0' width='38' height='30' alt='".$data['news_subject']."' title='".$data['news_subject']."' />";
echo"</li>";
}
echo "</ul>";
} else {
echo $locale['featured002'];
}
echo "</div>";
echo "</td>\n</tr>\n</table>\n";
closetable();[/syntaxhighlighter]
echo " <h2><span>".$data['news_subject']."</span></h2>\n";
#bigpic h2 {
position: absolute;
top: 150px;
left: 0;
width: 496px;
padding: 0 5px;
}
#bigpic h2 span {
color: white;
font: bold 24px/45px Helvetica, Sans-Serif;
letter-spacing: -1px;
background: rgb(0, 0, 0); /* fallback color */
background: rgba(0, 0, 0, 0.7);
padding: 10px;
}
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
5 participants
Notifications
You are not receiving notifications from this thread.
Related Questions