Simple Machines Community Forum

SMF Support => Language Specific Support => Italiano (Italian) => Topic started by: hollywood9111 on April 06, 2014, 11:27:01 AM

Title: aggiugere conteggio download allegati
Post by: hollywood9111 on April 06, 2014, 11:27:01 AM
e possibile aggiungere nella colonna dei topic come nella foto
sotto aggiungere quante volte e stato scaricato l'allegato?
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi61.tinypic.com%2F2i6dzrb.png&hash=49b435e9d628cccfc8250b75f48568f2875812bf)
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on April 06, 2014, 02:41:00 PM
Non in maniera troppo facile.
Onestamente adesso non posso guardare al codice, come indicazioni di massima, il modo più semplice credo sia fare un'altra query andando a cercare l'allegato al primo messaggio del topic (id_first_msg dovresti averlo dalle informazioni dei topic), ovvio che dovrai collezionare gli id dei primi messaggi di tutti i topic che stai visualizzando e poi fare una query prendendo tutti i primi allegati, quindi andrai ad aggiungere il dato all'arrai che già contiene le info dei topic ed infine modificherai il template aggiungendo il nuovo dato.

A memoria direi che la query dovrebbe assomigliare a questa:
$request = $smcFunc['db_query']('', '
    SELECT id_attach, downloads
    FROM {db_prefix}attachments
    WHERE id_msg IN ({array_int:id_msgs})',
    array(
        'id_msgs' => $array_messaggi
    )
);
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on April 06, 2014, 07:54:30 PM
dentro al topic e viene visualizzato quante vokte e stato scaricato.l allegato.non si puo stampare quel.valore.nella colonna delle visite e risposte?
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on April 07, 2014, 04:33:35 AM
Quello che ho scritto sopra è quello che devi fare per fare quello che hai proposto tu. ;)
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on April 07, 2014, 08:06:42 AM
mi puoiaiutare a generera il tutto?
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on April 07, 2014, 02:31:39 PM
Vedrò cosa posso fare, ma questa e la prossima settimana sono piuttosto preso, non so quanto tempo libero riuscirò a trovare... >_<
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on April 07, 2014, 06:09:06 PM
ok nn preoccuparti.anzi attendero grazie.mille
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on April 30, 2014, 08:58:10 AM
novità?
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on April 30, 2014, 04:52:33 PM
MessageIndex.php:
Code (trova) Select
determineTopicClass($context['topics'][$row['id_topic']]);
}
$smcFunc['db_free_result']($result);

Code (sostituisci con) Select
determineTopicClass($context['topics'][$row['id_topic']]);
if (!isset($messages_id))
$messages_id = array();
$messages_id[$row['id_first_msg']] = $row['id_topic'];
}
$smcFunc['db_free_result']($result);

if (!empty($messages_id))
{
$request = $smcFunc['db_query']('', '
SELECT id_attach, downloads, id_msg
FROM {db_prefix}attachments
WHERE id_msg IN ({array_int:id_msgs})',
array(
'id_msgs' => array_keys($messages_id),
)
);
while ($row = $smcFunc['db_fetch_assoc']($request))
$context['topics'][$messages_id[$row['id_msg']]]['dl_attach'] = comma_format($row['downloads']);
$smcFunc['db_free_result']($request);
}


MessageIndex.template.php:
Code (trova) Select

<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], '
</td>

Code (sostituisci con) Select

<td class="stats ', $color_class, '">
', $topic['replies'], ' ', $txt['replies'], '
<br />
', $topic['views'], ' ', $txt['views'], isset($topic['dl_attach']) ? '
<br />
' . $topic['dl_attach'] . ' download' : '', '
</td>

testato velocemente, dovrebbe funzionare.
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on May 01, 2014, 08:31:47 AM
questa modifica al mio tema o a quello default?
perchè al mio c'è solo
MessageIndex.template.php
e anche nel default
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on May 01, 2014, 09:07:31 AM
Beh, mal che vada la fai ad entrambi e sei a posto.
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on May 01, 2014, 09:18:55 AM
ma il fatto e che non c'è questo
MessageIndex.php
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on May 01, 2014, 02:33:17 PM
qualcosa.template.php => directory Themes/tema
qualcosa.english.php => directory Themes/default/languages
qualcosa.php => directory Sources

;)
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on May 01, 2014, 05:14:04 PM
in source ho questo: MessageIndex.php
in tema defualt ho il message index template
nel mio tema ho il message index template

mi spieghi cosa fare perchè mi sono perso... :(
Title: Re: aggiugere conteggio download allegati
Post by: emanuele on May 02, 2014, 02:29:14 AM
Ho scritto sopra ad ogni modifica il nome di file a cui va fatta, quindi sia MessageIndex.php sia MessageIndex.template.php andranno modificati.

Ora, siccome stiamo parlando non del tema di default, ma di MundoQuelCheE' e MundoQuelCheE' ha un file MessageIndex.template.php, farai la modifica al file di quel tema. ;)
Title: Re: aggiugere conteggio download allegati
Post by: hollywood9111 on May 02, 2014, 06:42:05 AM
ok era in sources il messageindex.
grazie mille :)