Ajouté des notifications dans votre bloc menu
Category : Personalisé Nuked Klan
Added on : Le 2 septembre 2013
Author : kotshiro
readings : 1718
637 Personnes aiment ce tuto et vous !!
Note :  [ Rate ]

Voici comment ajouté des notifications à votre bloc menu, un peu à la manière de l'iphone .

-1 Tout d'abord, faite une sauvegarde de votre block_menu.php situé dans le dossier ( Includes/blocks ) de votre site.

?-2 Nous allons créer en premier lieu un fichier que vous allé nommé template.php ( pour une jolie notification :-) )avec dedans :

defined('INDEX_CHECK') or die;


global $bgcolor1, $bgcolor2, $bgcolor3;
// Definition des 3 couleurs, par defaut ceux de nuked-klan, vous pouvez les remplacer par un code couleur.
// Exemple : $color1 = "#FFFFFF";

$color1 = $bgcolor1;
$color2 = $bgcolor2;
$color3 = $bgcolor3;

avant d'insérez le style n'oublié pas de fermé la balise php de cette manière :

?>

ensuite inséré le style comme suit :

<style type="text/css">

.noti_bubble {
    position: relative;
        width:20px;
        height:20px;
        text-align: center;
        margin-top:-2px;
        margin-left:-5px;
        background:    -moz-radial-gradient( center -9px, circle closest-side, white 0, red 26px );
        background:     -ms-radial-gradient( center -9px, circle closest-side, white 0, red 26px );
        background:      -o-radial-gradient( center -9px, circle closest-side, white 0, red 26px );
        background: -webkit-radial-gradient( center -9px, circle, white 0, red 26px );
        background-color:red;
        color:white;
        font-weight:bold;
        font-size:0.75em;
        border-radius:50px;
        border: 2px solid white;
        box-shadow:1px 1px 1px black;
}

</style>

Enregistré votre fichier dans le dossier ( Includes/blocks ).

-3 Ouvrez block_menu.php avec un éditeur de text, par exemple Notepad++ dispo ici http://portableapps.com/apps/development/notepadpp_portable

Nous allons inclure le style que nous venons de créer de cette manière dans la function block_link? :

include('Includes/blocks/template.php');

Calculé la date de la notif de cette manière  : 

$date=mktime(date("m"),date("d"),date("Y"));

Calcul des notifications par module de cette manière :

    //guestbook
    $sqlguestbook = mysql_query("SELECT COUNT(*) FROM ".GUESTBOOK_TABLE." WHERE date > '".$date."' ");
    list($countguest) = mysql_fetch_array($sqlguestbook);    
    if ($countguest) { $afficheguest = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countguest."</xx>"; }
   
    //fofo
    $sqlfofofofof = mysql_query("SELECT COUNT(*) FROM ".FORUM_MESSAGES_TABLE." WHERE date > '".$date."' ");
    list($countfofo) = mysql_fetch_array($sqlfofofofof);    
    if ($countfofo) { $affichefofo = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" /><xx class=\"noti_bubble\">".$countfofo."</xx>"; }
    
    //news
    $sqlnews = mysql_query("SELECT COUNT(*) FROM ".NEWS_TABLE." WHERE date > '".$date."' ");
    list($countnews) = mysql_fetch_array($sqlnews);    
    if ($countnews) { $affichenews = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countnews."</xx>"; }
   
    //Ressources
    $sqldownlo = mysql_query("SELECT COUNT(*) FROM ".DOWNLOAD_TABLE." WHERE date > '".$date."' ");
    list($countdownloads) = mysql_fetch_array($sqldownlo);    
    if ($countdownloads) { $affichedownloads = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countdownloads."</xx>"; }
    
    //Liens
    $sqlliens = mysql_query("SELECT COUNT(*) FROM ".LINKS_TABLE." WHERE date > '".$date."' ");
    list($countliens) = mysql_fetch_array($sqlliens);    
    if ($countliens) { $affichelinks = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countliens."</xx>"; }
    
    //membres
    $sqlmembre = mysql_query("SELECT COUNT(*) FROM ".USER_TABLE." WHERE date > '".$date."' ");
    list($countusers) = mysql_fetch_array($sqlmembre);    
    if ($countusers) { $afficheusers = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countusers."</xx>"; }
    
    //wars
    $sqldefy = mysql_query("SELECT COUNT(*) FROM ".DEFY_TABLE." WHERE date > '".$date."' ");
    list($countdefy) = mysql_fetch_array($sqldefy);    
    if ($countdefy) { $affichedefy = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countdefy."</xx>"; }
 
    //sections
    $sqlsections = mysql_query("SELECT COUNT(*) FROM ".SECTIONS_TABLE." WHERE date > '".$date."' ");
    list($countsections) = mysql_fetch_array($sqlsections);    
    if ($countsections) { $affichesections = "&nbsp;<img alt=\"Update\" src=\"".$nuked['url']."/Includes/blocks/images/maj.gif\" style=\"width: 34px; height: 9px;\" /><xx class=\"noti_bubble\">".$countsections."</xx>"; }

Affichage des notifs dans le menu, après :

if ($nivuser >= $nivo){

rajouté :

        	if ($url == 'index.php?file=Forum') {$afficheff = $affichefofo;} else {$afficheff = '';}
        	if ($url == 'index.php?file=News') {$affichenews = $affichenews;} else {$affichenews = '';}
        	if ($url == 'index.php?file=Download') {$affichedd = $affichedownloads;} else {$affichedd = '';}
        	if ($url == 'index.php?file=Members') {$afficheuu = $afficheusers;} else {$afficheuu = '';}
        	if ($url == 'index.php?file=Links') {$affichell = $affichelinks;} else {$affichell = '';}
        	if ($url == 'index.php?file=Guestbook') {$affichebook = $afficheguest;} else {$affichebook = '';}
        	if ($url == 'index.php?file=Defy') {$affichedef = $affichedefy;} else {$affichedef = '';}
        	if ($url == 'index.php?file=Sections') {$affichesec = $affichesections;} else {$affichesec = '';}

et remplacé cette ligne :

            if ($url <> '' && $title <> '' && $blank == 0)
                $screen .= '<li><a href="' . $url . '" title="' . $comment . '" style="padding-left: 10px" class="menu">' . $title . '</a></li>';

par celle ci :

            if ($url <> '' && $title <> '' && $blank == 0)
                $screen .= '<li><a href="' . $url . '" title="' . $comment . '" style="padding-left: 10px" class="menu">' . $title . '</a>'.$afficheff.''.$affichenews.''.$affichedd.''.$afficheuu.''.$affichell.''.$affichebook .''.$affichedef.''.$affichesec.'</li>';

N'oubliez pas l'image que voici  à mettre dans votre dossier ( Includes/blocks/images ) 

ps : vous pouvez bien sur la changé à votre guise.

Voilà le tuto est terminé si vous un soucis, posté dans le forum .