Nichts für ungut, aber Dein CodeStyle ist etwas, nunja...., geschwätzig ums mit verlaub zu sagen... Je mehr Code zu laden und zu verarbeiten ist, desto schlechter die Performance. Man sollte sich also angewöhnen, so wenig Code wie möglich und so viel Code wie notwendig zu verwenden. Hier mal eine etwas bereinigte Version:
function widget_video_buildEmbed($subID, $minLines, $maxLines, $animeName, $animeLinkID, $progress)
{
$rechnung = round(100/$maxLines*$minLines,2);
$rechnung2 = round(1.88*$rechnung-(1.88*$rechnung/100*2),2);
$object =
'<object>'
. ' <a href="?p='.$animeLinkID.'">'.$animeName.'</a>'
. ' <hr size="1" />'
. ' <div style="font-size: 14px; color: black; width: 188px;">'
. ' <strong>'.$subID.'</strong>'
. ' </div>';
. ' <div style="border: 1px dotted red; width: 188px; height: 14px;">'
. ' <div style="margin: 2px; width: '.$rechnung2.'px; height: 10px; background-color: darkred;"></div>'
. ' </div>'
. ' <div style="font-size: 10px; color: red; width: 188px;">'.$minLines.' of '.$maxLines.' lines ('.$rechnung.'%)</div>'
. ' <hr size="1" />'
. ' <div style="font-size: 10px; width: 100px; float:left;">'
. ' <div style="color: black; ">preparing lines:</div>'
. ' <div style="color: black; ">translation:</div>'
. ' <div style="color: black; ">quality check:</div>'
. ' </div>';
if($progress == 1){
$object .=
' <div style="font-size: 10px; width: 88px; float:left;">'
. ' <div style="color: red; ">in progress</div>'
. ' <div style="color: red; ">in progress</div>'
. ' <div style="color: red; ">in progress</div>'
. ' </div>';
}
else if($progress == 2){
$object .=
' <div style="font-size: 10px; width: 100px; float:left;">'
. ' <div style="color: green; ">done</div>'
. ' <div style="color: red; ">in progress</div>'
. ' <div style="color: red; ">in progress</div>'
. ' </div>';
}
else if($progress == 3){
$object .=
' <div style="font-size: 10px; width: 100px; float:left;">'
. ' <div style="color: green; ">done</div>'
. ' <div style="color: green; ">done</div>'
. ' <div style="color: red; ">in progress</div>'
. ' </div>';
}
else {
$object .=
' <div style="font-size: 10px; width: 100px; float:left;">'
. ' <div style="color: green; ">done</div>'
. ' <div style="color: green; ">done</div>'
. ' <div style="color: green; ">done</div>'
. ' </div>';
}
$object .= '</object>';
return $object;
}
Alles anzeigen
und wenn man sich dann auch noch angewöhnt die Schachtelungsebenen des HTML-Codes auch im PHP-Code abzubilden, sieht man meist genau woran der ausgegebene HTML-Code krankt....
vG
Arno
PS ich habe mir angewöhnt, alles was als eine Einheit anzusehen ist, mit einem DIV das alles umspannt abzugeben. Ist vor allen dingen dann nützlich, wenn man selbiges später durch separate Auszeichnungen nochmals hervorheben möchte.