Einzelnen Beitrag anzeigen
  #2 (permalink)  
Alt 29.07.10, 21:21
Benutzerbild von Attain
Attain Attain ist offline
Senior Member
 
Registriert seit: Feb 2008
Ort: 127.0.0.1
Beiträge: 371
Standard

Hi Robert,

i'll try to answer in english.
I wrote the following function to display different messages at the "dashbord" and also in to the "webfront".
PHP-Code:
function SetMessageList($ID,$sender,$message){
    
$quantity 6;                                              //how many messages are displayd
    
$header ='<body bgcolor="#a6caf0"><style type="text/css">table.list { width: 100%; border-collapse: true;} table.list td { border: 1px solid #444455; } table.list th { border: 1px solid #444455; }</style>';
    
$header.='<table frame="box" class="list">';
   
$header.='<tr>';
   
$header.='<th>Datum</th>';                                   //head of the table
   
$header.='<th>Uhrzeit</th>';
   
$header.='<th>Sender</th>';
   
$header.='<th>Meldung</th>';
   
$header.='</tr>';

    
$data ='<tr align="center"><td>'.date("d.m.Y").'</td>';
      
$data.='<td>'.date("H:i").'</td>';
   
$data.='<td>'.$sender.'</td>';
   
$data.='<td>'.$message.'</td>';

   
$string GetValue($ID);
    
$buffer explode("</tr>",$string);                                    //explode the string in to the array
   
array_shift ($buffer);                                      //delete the header
   
array_unshift ($buffer$data);                                       //new row to the beginning of an array
   
$buffer array_slice $buffer0$quantity );              //remove oldest message
    
$string implode("</tr>",$buffer);                           //implode array back to string
   
SetValue($ID$header $string "</table></body>");       //save html string

You have to add a stringvariable with profile "~HTMLBox".
Then You can add a new row in to the list with:
PHP-Code:
SetMessageList(51809,"test","new message"); 
51809 is the String Variable ID

Questions?

benefit: only one variable is needed

regards
Attain
Miniaturansicht angehängter Grafiken
wf.png  
Mit Zitat antworten