Pagina 1 di 1
Whos_online nel footer
Inviato: 16/09/2005, 13:22
da sakkiotto
Vorrei inserire il numero dei clienti online nel footer invice che in un box.
Avevo pensato ad aggiungere nel footer:
Codice: Seleziona tutto
require(DIR_WS_FUNCTIONS . 'whos_online.php');
<td align="right" class="footer"> <?php echo $whos_online ?> </td>[
ma non funge, dove sbaglio?
Grazie
Inviato: 16/09/2005, 14:09
da itan80
prova con questo codice:
<?php
// Set expiration time, default is 900 secs (15 mins)
$xx_mins_ago = (time() - 900);
tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where time_last_click < '" . $xx_mins_ago . "'");
$whos_online_query = tep_db_query("select customer_id from " . TABLE_WHOS_ONLINE);
while ($whos_online = tep_db_fetch_array($whos_online_query)) {
if (!$whos_online['customer_id'] == 0) $n_members++;
if ($whos_online['customer_id'] == 0) $n_guests++;
$user_total = sprintf(tep_db_num_rows($whos_online_query)); }
if ($user_total == 1) {
$there_is_are = BOX_WHOS_ONLINE_THEREIS . ' ';
} else {
$there_is_are = BOX_WHOS_ONLINE_THEREARE . ' ';
}
if ($n_guests == 1) {
$word_guest = ' ' . BOX_WHOS_ONLINE_GUEST;
}else{
$word_guest = ' ' . BOX_WHOS_ONLINE_GUESTS;
}
if ($n_members == 1) {
$word_member = ' ' . BOX_WHOS_ONLINE_MEMBER;
}else{
$word_member = ' ' . BOX_WHOS_ONLINE_MEMBERS;
}
if (($n_guests >= 1) && ($n_members >= 1)) $word_and = ' ' . BOX_WHOS_ONLINE_AND . ' <br>';
$textstring = $there_is_are;
if ($n_guests >= 1) $textstring .= $n_guests . $word_guest;
$textstring .= $word_and;
if ($n_members >= 1) $textstring .= $n_members . $word_member;
$textstring .= ' online.' . ' <br>';
// if (tep_session_is_registered('customer_id')) {
// $textstring .= '<a href="online_list.php">' . BOX_VIEW_ONLINE_MEMBERS . '</a>';
// }
$info_box_contents2 = array();
$info_box_contents2 = array();
$info_box_contents2[] = array('align' => 'left',
'text' => $textstring
);
new infoBox($info_box_contents2);
?>
ciao
Inviato: 16/09/2005, 14:44
da sakkiotto
Beh, quel codice crea un nuovo box, io invece vorrei inserirlo in quello già presente dove ho il numero totale di visite.
Codice: Seleziona tutto
?>
<div align="center">
<table border="0" width="800" cellspacing="0" cellpadding="1">
<tr class="footer">
<td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td>
<td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td>
</tr>
</table>
<br>
<table border="0" width="800" cellspacing="0" cellpadding="0">
<tr>
<td align="center" class="smallText">
<?php
Inviato: 16/09/2005, 15:09
da Bass
sakkiotto ha scritto:Beh, quel codice crea un nuovo box, io invece vorrei inserirlo in quello già presente dove ho il numero totale di visite.
Elimina la parte finale, quella che chiama la classe infobox
Codice: Seleziona tutto
$info_box_contents2 = array();
$info_box_contents2 = array();
$info_box_contents2[] = array('align' => 'left',
'text' => $textstring
);
new infoBox($info_box_contents2);
E prova utilizzando la variabile $textstring
'iao
Sergio
Inviato: 16/09/2005, 16:02
da sakkiotto
Grazie
Se può servire...
Codice: Seleziona tutto
<td align="right" class="footer"><?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted ; ?>  - <?php echo $textstring ; ?></td>
Inviato: 16/09/2005, 16:58
da plume
carino.. lo uso pure io
Ciao
Plume