Geeklog France
 

Block Blogroll

Mise à jour pour Geeklog 1.5.1

function phpblock_blogroll ()
{
    global $_CONF, $_TABLES;
 
    // configuration options:
 
    $cat = 'Logiciel'; // cid to take links from (e.g. If category is Geeklog Sites, cid is geeklog-sites
    $directlink = false; // Use direct links (true) or portal.php (false)
    $random = false;     // Random order (true) or sort by $sort (false)
    $sort = 'hits';     // Sort by 'date', 'title', 'url', 'hits'
    $order = 'DESC';    // Order is ASC or DESC
 
    // === you shouldn't need to change anything below this line ==============
    $retval = '';
 
    $result = DB_query ("SELECT lid,url,title,description,hits FROM {$_TABLES['links']}  WHERE cid='$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort $order");
    $numLinks = DB_numRows ($result);
 
    $links = array ();
    for ($i = 0; $i < $numLinks; $i++) {
        $A = DB_fetchArray ($result);
 
        if ($directlink) {
            $url = $A['url'];
            $link = '<a href="' . $url . '">';
 
        } else {
            $url = $_CONF['site_url']
                 . COM_buildUrl ('/links/portal.php/link/' . $A['lid']);
            $link = '<a href="' . $url . '" title="' . $A['url'] . '">';
 
        }
        $links[] = $link . stripslashes ($A['title']) . '</a>' . ' (' . ($A['hits']) . ')' . '<br><i>' . ($A['description']) . '<br><br></i>';
    }
 
    if (count ($links) > 0) {
 
        if ($random) {
            $min = 0;
            $max = count ($links) - 1;
 
            $newlist = array ();
            do {
                $r = rand ($min, $max);
 
                if (!empty ($links[$r])) {
                    $newlist[] = $links[$r];
                    unset ($links[$r]);
                }
 
                if ($r == $min) {
                    $min = $r + 1;
                } else if ($r == $max) {
                    $max = $r - 1;
                }
                if ($min == $max) {
                    if (!empty ($links[$min])) {
                        $newlist[] = $links[$min];
                    }
                    break;
                }
            }
            while ($max > $min);
 
            $retval = COM_makeList ($newlist, 'list-blogroll');
        } else {
            $retval = COM_makeList ($links, 'list-blogroll');
        }
    }
 
    return $retval;
}
Connecté en tant que : Guest (Guest)
blocks/blogroll.txt · Dernière modification: 2009/01/20 13:56 par ::Ben
 

Download geeklog

Last version 1.8.1

Espace Membre





Devenir membre
Enregistrez-vous

Mot de passe oublié ?

Change language

Categories

  • Geeklog (38)
  • Plugins (53)
  • Thèmes (17)
  • My cart

    Votre panier (0 article)

    Votre panier est vide!

    0.00 EUR

    Visual Theme Switcher

    Test out available themes by selecting from one of the 6 available themes or give the Visual Switcher a try:

    Follow us on twitter

    En ligne

    Visiteurs: 10