- Код: Выделить всё
$percent = min(100, round(exec('ps ax | grep -c apache') / 256 * 100));
if ( $percent <= 70 ) $pic = "loadbargreen.gif";
elseif ($percent <= 90) $pic = "loadbaryellow.gif";
else $pic = "loadbarred.gif";
$width = $percent * 4;
$template->assign_vars(array(
'PERCENT' => $percent,
'WIDTH' => $width,
'PIC' => $pic)
);
index_body.html
- Код: Выделить всё
<table width=750 class=detail2 border=1 cellspacing=0 cellpadding=20>
<caption>{L_SERVER_LOAD} {PERCENT}%</caption>
<tr>
<td align=center>
<table class=detail2 border=1 cellspacing=0 cellpadding=5><tr><td align=center>
<table class=main border='0' width=402><tr><td style='padding: 0px; background-image: url("pic/loadbarbg.gif"); background-repeat: repeat-x'>
<img height='15' width={WIDTH} src="pic/{PIC}" alt='{PERCENT}%'>
</td></tr></table>
pic/

