Fork me on GitHub

Rapport de message :*
 

Re: Hack block wfdownloads

Titre du sujet : Re: Hack block wfdownloads
par machenzy sur 06/12/2004 17:46:55

Ok après quelques essais, je vous propose le résultat final qui permet donc d'obtenir un bloc affichant une icônes "maf" ou "new" puis le nom du dl, puis la version, puis la date d'upload ou de mise à jour :

Modification du fichier ".../modules/wfdownloads/blocks/wfdownloads_top.php" ligne 36 :

=> On ajoute la sortie des variables "status, updated, version" de la table

Avant
$result $xoopsDB->query("SELECT lid, cid, title, date, hits FROM " $xoopsDB->prefix('wfdownloads_downloads') . " WHERE status > 0 AND offline = 0 ORDER BY " $options[0] . " DESC"$options[1], 0);


Après
$result $xoopsDB->query("SELECT lid, cid, title, date, status, updated, version, hits FROM " $xoopsDB->prefix('wfdownloads_downloads') . " WHERE status > 0 AND offline = 0 ORDER BY " $options[0] . " DESC"$options[1], 0);


Modification du fichier ".../modules/wfdownloads/blocks/wfdownloads_top.php" ligne 33 :

=> Dénomination des variables qui serviront pour le template

Avant
if ($options[0] == "date")
            {
                
$download['date'] = formatTimestamp($myrow['date'], $xoopsModuleConfig['dateformat']);


Après
if ($options[0] == "date")
            {
                
$download['date'] = formatTimestamp($myrow['date'], $xoopsModuleConfig['dateformat']);
            
$download['status'] = $myrow['status'];
            
$download['updated'] = formatTimestamp($myrow['updated'], $xoopsModuleConfig['dateformat']);
            
$download['version'] = $myrow['version'];


Modification du fichier ".../modules/wfdownloads/templates/blocks/wfdownloads_block_new.html" :

=> Habillez comme vous voulez votre block, pour ma part, voici mon code

<ul>   <{foreach item=download from=$block.downloads}>
<
li>

<{if 
$download.status == "2"}>
<
img src="<{$xoops_url}>/modules/<{$download.dirname}>/images/maj.gif">
<{else}>
<
img src="<{$xoops_url}>/modules/<{$download.dirname}>/images/new.gif">
<{/if}>
      
<
a href="<{$xoops_url}>/modules/<{$download.dirname}>/singlefile.php?cid=<{$download.cid}>&lid=<{$download.id}>"><{$download.title}> - v.<{$download.version}></a

<{if 
$download.status == "2"}>
(
MAJ le <{$download.updated}>)
<{else}>
(
Uploadé le <{$download.date}>)
<{/if}>

</
li>   <{/foreach}> </ul>


Maintenant, il faut mettre à jour le module "wfdownloads", et ajouter les images "new.gif" et "maj.gif" dans le répertoire ".../modules/wfdownloads/images"

Voilà, bon habillage de block wfdownloads
@+
Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

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