Fork me on GitHub

Rapport de message :*
 

Utilisateurs en ligne et thème

Titre du sujet : Utilisateurs en ligne et thème
par alain01 sur 04/01/2013 10:07:29

Salut les pro du smarty,

Après avoir lu et relu l'article de thecat (que j'ai bien connu) sur les smarty, je ne maitrise toujours pas...

Mon but :
ne plus afficher le bloc "qui est en ligne" mais intégrer l'information dans le thème, comme le fait celui de frxoops.org, en bas de thème.


J'ai bien regardé les templates, et le fichier html et j'ai :
function b_system_online_show() { global $xoopsUser$xoopsModule$online_handler =& xoops_gethandler('online'); mt_srand((double)microtime()*1000000); // set gc probabillity to 10% for now.. if (mt_rand(1, 100) < 11) { $online_handler->gc(300); } if (is_object($xoopsUser)) { $uid = $xoopsUser->getVar('uid'); $uname = $xoopsUser->getVar('uname'); } else { $uid = 0; $uname = ''; } if (is_object($xoopsModule)) { $online_handler->write($uid, $uname, time(), $xoopsModule->getVar('mid'), $_SERVER['REMOTE_ADDR']); } else { $online_handler->write($uid, $uname, time(), 0, $_SERVER['REMOTE_ADDR']); } $onlines = $online_handler->getAll(); if (false != $onlines) { $total = count($onlines); $block = array(); $guests = 0; $members = ''; for ($i = 0; $i < $total; $i++) { if ($onlines[$i]['online_uid'] > 0) { $members .= ' <a href="' . XOOPS_URL . '/userinfo.php?uid=' . $onlines[$i]['online_uid'] . '" title="' . $onlines[$i]['online_uname'] . '">' . $onlines[$i]['online_uname'] . '</a>,'; } else { $guests++; } } $block['online_total'] = sprintf(_ONLINEPHRASE, $total); if (is_object($xoopsModule)) { $mytotal = $online_handler->getCount(new Criteria('online_module', $xoopsModule->getVar('mid'))); $block['online_total'] .= ' ('.sprintf(_ONLINEPHRASEX, $mytotal, $xoopsModule->getVar('name')).')'; } $block['lang_members'] = _MEMBERS; $block['lang_guests'] = _GUESTS; $block['online_names'] = $members; $block['online_members'] = $total - $guests; $block['online_guests'] = $guests; $block['lang_more'] = _MORE; return $block; } else { return false; } }


et le bloc initiale est le suivant :
<{$block.online_total}> <br /><br /> <{$block.lang_members}>: <{$block.online_members}> <br /> <{$block.lang_guests}>: <{$block.online_guests}> <br /><br /> <{$block.online_names}> <a href="javascript:openWithSelfMain('<{$xoops_url}>/misc.php?action=showpopups&type=online','Online',420,350);" title="<{$block.lang_more}>"> <{$block.lang_more}> </a>


Alors j'ai essayé d'intégrer un peu tout dans mon thème mais rien ne fonctionne, (genre :
En ligne : <{$total}> visiteurs en ligne
)
je ne maiiiiiiiitrise passsssss...

Une aide pédagogique me serait fort utile svp !


Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

29 Personne(s) en ligne (22 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 29 | Plus ...