How to customize the Servicestatus page ?

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
Unfortunately, this has gotten garbled with the change in forums. Can someone paste the correct version of this? I am not familiar with php enough to know which characters are correct and which are not.

Originally posted by qualitum
Easy. Write a PHP script that grabs the output from the servicestatus() function, then filter it and print the results.

Sample code:

&?php
// Swedish translation of returned values
$table = &&cpanel Serverinfo=&servicestatus()&&&;
$table = str_replace (&Memory Used&, &Använt minne&, $table );
$table = str_replace (&Server Load&, &Serverbelastning&, $table );
$table = str_replace (&Swap&, &Växlingsminne (swap)&, $table );
$table = str_replace (&mysql&, &MySQL&, $table );
$disks ='';
$info = '';

preg_match_all('|&tr.*tr&|U', $table, $match);

foreach ($match[0] as $line)
{
// Put disks in a separate table
if (strpos($line, 'Disk'))
{
$disks.=$line;
}
else
{
$info.= $line;
}
}
?&
&cpanel setvar=&headerimg=images/home.gif&&
&cpanel include=&stdheader.html&&
&br&

&table align=center border=1 class=tdshade2 cellpadding=9&
&tr&
&td valign=top&
&h2&Serverstatus&/h2&
&table align=center border=1 class=tdshade2&
&?php echo $info; ?&
&/table&
&/td&

&td valign=top&
&h2&Diskstatus&/h2&
&table align=center border=1 class=tdshade2&
&?php echo $disks; ?&
&/table&
&/td&
&/tr&
&/table&

&br&&br&
&cpanel include=&stdfooter.html&&
 

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
Very good, indeed. EXACTLY what I was looking for. Thank you Juanra!!