phpBB Italia chiude!
phpBB Italia ringrazia tutti gli utenti che hanno dato fiducia al nostro progetto per ben 9 anni, e che, grazie al grande lavoro fatto da tutto lo Staff (rigorosamente a titolo gratuito), hanno portato il portale a diventare il principale punto di riferimento italiano alla piattaforma phpBB.

Purtroppo, causa motivi personali, non ho più modo di gestirlo e portarlo avanti. Il forum viene ora posto in uno stato di sola lettura, nonché un archivio storico per permettere a chiunque di fruire di tutte le discussioni trattate.

Il nuovo portale di assistenza per l'Italia di phpBB diventa phpBB-Store.it, cui ringrazio per aver deciso di portare avanti questo grande progetto.

Grazie ancora,
Carlo - Amministratore di phpBB Italia

[RELEASED] Mod Topten Topics ver 1.0.2

Sezione in cui vengono spostati argomenti di MOD in sviluppo oramai rilasciate.
Bloccato
Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

[RELEASED] Mod Topten Topics ver 1.0.2

Messaggio da Micogian » 11/12/2010, 16:59

Nome MOD: [DEV] Top Ten Topics ver. 1.0.2
Descrizione MOD: Crea una tabella nella Home con tre liste diverse: i 10 Topics più recenti (data, Titolo, Autore), i 10 Topics più visti (Visite, Titolo, Autore) ed i 10 ultimi Posts (risposte) (Titolo, Autore).

Demo: http://www.actafungorum.org/actaforum/ (fondo pagina)

Cronologia:
  • 23/01/2010 - Iniziato sviluppo della MOD a due colonne (più recenti e più visti).
  • 25/01/2010 - Modifica della Mod con inserimento di una terza lista (Topics con maggiori repliche)
  • 11/12/2010 - Revisione della Mod: creato un file mod_topten.php che contiene 4 query relative a "Ultimi Topics, Topics più visti, Topics con maggiori risposte e Ultimi Posts (ultime risposte)".
    Di queste 4 possibilità se ne possono scegliere 3 (per ragioni di spazio).
    Il codice non viene più inserito nel file index.php ma viene inserito tramite un "include", questo semplifica le cose lasciando quasi inalteraro il file index.php originale.
    La stessa cosa avviene con il template, attraverso un file esterno che viene "incluso" in insex_body.html.
Autore: Micogian (alias Bingo)
Versioni phpBB compatibili: 3.0.x

Istruzioni:

1) creare un file mod_topten_topics.php
2) inserire "include" nel file index.php
3) creare template mod_toptent_topics_body.html
4) inserire "include" nel file styles/prosilver/template/index_body.html

1) Creare il file mod_topten_topics.php
Il file va inserito nella root del forum, questo il contenuto:

Codice: Seleziona tutto

<?php
// MOD Topten Topics ver. 1.0.2
// Topics più recenti, Topics più visti, Topics con maggiori risposte e Posts più recenti 
// created by Micogian 2010

// configurazione: numero dei recods da visualizzare nella Lista

$lista = 10 ; // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics 
$lista_dati = 20 ;  // numero di topics  da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
$lista_posts = 50 ; // numero di posts da estrarre dalla tabella (il numero è più alto perchè viene inserito un solo post per topic)

function mese_cor($data_cor)
{
$data_short = str_replace("Jan","gen", $data_cor);
$data_short = str_replace("Feb","feb", $data_cor);
$data_short = str_replace("Mar","mar", $data_cor);
$data_short = str_replace("Apr","apr", $data_cor);
$data_short = str_replace("Mag","mag", $data_cor);
$data_short = str_replace("Jun","giu", $data_cor);
$data_short = str_replace("Jul","lug", $data_cor);
$data_short = str_replace("Aug","ago", $data_cor);
$data_short = str_replace("sep","set", $data_cor);
$data_short = str_replace("Oct","ott", $data_cor);
$data_short = str_replace("Nov","nov", $data_cor);
$data_short = str_replace('Dec','dic', $data_cor);
return $data_short;
}
//---------- 10 Topics più Recenti start -----------//

$sql1 = "SELECT tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_time, tt.topic_moved_id, tt.topic_first_poster_name,
    ft.forum_id, ft.forum_name
    FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft 
    WHERE tt.topic_type = 0
    AND tt.topic_moved_id = 0
    AND tt.forum_id = ft.forum_id
    ORDER BY tt.topic_time DESC LIMIT 0,$lista_dati";
$result1 = $db->sql_query($sql1);
    $n1 = 0;
    while ($row1 = $db->sql_fetchrow($result1))
    {
       	if ($auth->acl_get('f_read', $row1['forum_id']) == 1) 
        {
            if ($n1 < $lista)
	    {
	        if (strlen($row1['topic_title']) > 28)
		{
		    $topic_title1 = substr($row1['topic_title'],0,27) . "...";
		}else{
		    $topic_title1 = $row1['topic_title'];
		}
		$last_topic_link[$n1]   = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row1['forum_id'] . "&t=" . $row1['topic_id']);
             	$last_topic_title[$n1]  	= $row1['topic_title'];
			$last_topic_title_short[$n1]  = $topic_title1;
			$last_topic_forum[$n1]  	= $row1['forum_name'];
             	$last_topic_author[$n1] 	= $row1['topic_first_poster_name'];
             	$last_topic_data[$n1]   	= date("d M",$row1['topic_time']);
          	++$n1 ;          	
            }
        }
    }
//---------- 10 Topics più Recenti end -----------//


//---------- 10 Topics più Visti start -----------//

$sql2 = "SELECT tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_first_poster_name, tt.topic_views,
    ft.forum_id, ft.forum_name 
    FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
    WHERE tt.forum_id = ft.forum_id
    ORDER BY tt.topic_views DESC LIMIT 0,$lista_dati";
$result2 = $db->sql_query($sql2);
    $n2 = 0 ;
    while ($row2 = $db->sql_fetchrow($result2))
    {
       if ($auth->acl_get('f_read', $row2['forum_id']) == 1)
       {
           if ($n2 < $lista)
	   {
		if (strlen($row2['topic_title']) > 28)
		{
		    $topic_title2 = substr($row2['topic_title'],0,27) . "...";
		}else{
		    $topic_title2 = $row2['topic_title'];
		}
			$view_topic_link[$n2]   	= append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row2['forum_id'] . "&t=" . $row2['topic_id']);
             	$view_topic_title[$n2]		= $row2['topic_title'];
			$view_topic_title_short[$n2]  = $topic_title2;	
			$view_topic_forum[$n2]  	= $row2['forum_name'];		
             	$view_topic_author[$n2] 	= $row2['topic_first_poster_name'];
             	$view_topic_views[$n2]  	= $row2['topic_views'];
                ++$n2 ;
           }
       }
    }
//---------- 10 Topics più visti end -----------//

/*

//---------- 10 Topics con più risposte start -----------//
$sql3 = "SELECT tt.topic_id, tt.forum_id, tt.topic_title, tt.topic_first_poster_name, tt.topic_replies,
    ft.forum_id, ft.forum_name 
    FROM " . TOPICS_TABLE . " tt, " . FORUM_TABLE . " ft
    ORDER BY tt.topic_replies DESC LIMIT 0,$lista_dati";
$result3 = $db->sql_query($sql3);
    $n3 = 0 ;
    while ($row3 = $db->sql_fetchrow($result3))
    { 
        if ($auth->acl_get('f_read', $row2['forum_id']) == 1) 
        {
            if ($n3 < $lista)
            {
                if (strlen($row3['topic_title']) > 28)
		{
		    $topic_title3 = substr($row3['topic_title'],0,27) . "...";
		}else{
		    $topic_title3 = $row3['topic_title'];
		}
		$replies_topic_link[$n3]     = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row3['forum_id'] . "&t=" . $row3['topic_id']);
             	$replies_topic_title[$n3]    		= $row3['topic_title'];
             	$replies_topic_title_short[$n3]    	= $topic_title3;
             	$replies_topic_forum[$n3]    		= $row3['forum_name'];
             	$replies_topic_author[$n3]   		= $row3['topic_first_poster_name'];
             	$replies_topic_replies[$n3]  		= $row3['topic_replies'];
                ++$n3 ;
            }
        }
    }
//---------- 10 Topics con più risposte end -----------//
*/


//---------- 10 Ultimi posts start -----------//

$sql4 = "SELECT pt.post_id, pt.topic_id, pt.forum_id, pt.post_subject, pt.post_time, pt.poster_id, 
    tt.topic_id, tt.topic_title,
    ut.user_id, ut.username,
    ft.forum_id, ft.forum_name
    FROM " . POSTS_TABLE . " pt, " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft, " . USERS_TABLE . " ut 
    WHERE pt.poster_id = ut.user_id
    AND pt.forum_id = ft.forum_id
    AND tt.topic_id = pt.topic_id
    ORDER BY pt.post_time DESC LIMIT 0,$lista_posts";
$result4 = $db->sql_query($sql4);
    $n4 = 0 ;
    $lista_topics = '' ;
    while ($row4 = $db->sql_fetchrow($result4))
    {
        if ($auth->acl_get('f_read', $row4['forum_id']) == 1) 
        {
       	    if( strpos($lista_topics, $row4['topic_id']) == '0' AND $n4 < $lista )
            {
	        if (strlen($row4['topic_title']) > 28)
	        {
		    $post_title = substr($row4['topic_title'],0,27) . "...";
	        }else{
		    $post_title = $row4['topic_title'];
	        }
			$last_post_link[$n4]		= append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "#p" . $row4['post_id']);
             	$last_post_title[$n4]    	= $row4['topic_title'];
             	$last_post_title_short[$n4]   = $post_title;
             	$last_post_forum[$n4]    	= $row4['forum_name'];
             	$last_post_author[$n4]   	= $row4['username'];
                $lista_topics .= "," . $row4['topic_id'] ;
                ++$n4 ;
            }
        }
    }
//---------- 10 Ultimi posts end -----------//

for ($x = 0; $x < $lista; ++$x)
{
 $template->assign_block_vars('topten_list',array(
	'LAST_TOPIC_LINK'	=> $last_topic_link[$x],
	'LAST_TOPIC_TITLE'		=> $last_topic_title[$x],
	'LAST_TOPIC_TITLE_SHORT'	=> $last_topic_title_short[$x],
	'LAST_TOPIC_FORUM'		=> $last_topic_forum[$x],
	'LAST_TOPIC_AUTHOR'		=> $last_topic_author[$x],
	'LAST_TOPIC_DATA'			=> mese_cor($last_topic_data[$x]),

	'VIEW_TOPIC_LINK'	=> $view_topic_link[$x],
	'VIEW_TOPIC_TITLE'		=> $view_topic_title[$x],
	'VIEW_TOPIC_TITLE_SHORT'	=> $view_topic_title_short[$x],
	'VIEW_TOPIC_FORUM'		=> $view_topic_forum[$x],
	'VIEW_TOPIC_AUTHOR'		=> $view_topic_author[$x],
	'VIEW_TOPIC_VIEWS'		=> $view_topic_views[$x],

	//'REPLIES_TOPIC_LINK'		=> $replies_topic_link[$x],
	//'REPLIES_TOPIC_TITLE'		=> $replies_topic_title[$x],
	//'REPLIES_TOPIC_TITLE_SHORT'	=> $replies_topic_title_short[$x],
	//'REPLIES_TOPIC_FORUM'		=> $replies_topic_forum[$x],
	//'REPLIES_TOPIC_AUTHOR'	=> $replies_topic_author[$x],
	//'REPLIES_TOPIC_REPLIES'	=> $replies_topic_replies[x],

	'LAST_POST_LINK'			=> $last_post_link[$x],
	'LAST_POST_TITLE'			=> $last_post_title[$x],
	'LAST_POST_TITLE_SHORT'		=> $last_post_title_short[$x],
	'LAST_POST_FORUM'			=> $last_post_forum[$x],
	'LAST_POST_AUTHOR'		=> $last_post_author[$x],
	));
}

?>
2) Modifica file index.php

TROVA

Codice: Seleziona tutto

// Output page
INSERISCI: prima

Codice: Seleziona tutto

include($phpbb_root_path . 'mod_topten_topics.' . $phpEx); 
3) Creare file mod_topten_topics_body.html (Prosilver)
Il file va inserito in styles/prosilver/template/ questo il contenuto:

Codice: Seleziona tutto

<!--  Mod topten_topics ver 1.0.2 by Micogian start -->
<div class="forabg">
	<div class="inner"><span class="corners-top"><span></span></span>
		<ul class="topiclist">
			<li class="header">
				<dl class="icon">
					<dd style="width: 34%">&nbsp;Ultimi Topics</dd>
					<dd style="width: 33%">&nbsp;Topics pi&ugrave; visti</dd>
					<dd>&nbsp;Ultimi Posts</dd>
				</dl>
			</li>
		</ul>
		<ul  class="topiclist forums" >
<!-- BEGIN topten_list -->
			<li>
				<dl>
					<dd style="width: 34%; padding: 1px">{topten_list.LAST_TOPIC_DATA} &nbsp;<a style="font-weight: bold" href="{topten_list.LAST_TOPIC_LINK}" title="{topten_list.LAST_TOPIC_TITLE} (in: {topten_list.LAST_TOPIC_FORUM})">{topten_list.LAST_TOPIC_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.LAST_TOPIC_AUTHOR})</span></dd>
					<dd style="width: 33%; padding: 1px">{topten_list.VIEW_TOPIC_VIEWS} &nbsp;<a style="font-weight: bold" href="{topten_list.VIEW_TOPIC_LINK}" title="{topten_list.VIEW_TOPIC_TITLE} (in: {topten_list.VIEW_TOPIC_FORUM})">{topten_list.VIEW_TOPIC_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.VIEW_TOPIC_AUTHOR})</span></dd>
					<dd style="padding: 1px"><a style=" font-weight: bold" href="{topten_list.LAST_POST_LINK}" title="{topten_list.LAST_POST_TITLE} (in: {topten_list.LAST_POST_FORUM})">{topten_list.LAST_POST_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.LAST_POST_AUTHOR})</span></dd>					
				</dl>
			</li>	
<!-- END topten_list -->
		</ul>
	<span class="corners-bottom"><span></span></span></div>
</div>
<!--  Mod topten_topics ver 1.0.2 by Micogian end -->
3 bis) Creare file mod_topten_topics_body.html (Subsilver2)
Il file va inserito in styles/subsilver2/template/ questo il contenuto:

Codice: Seleziona tutto

<!--  Mod topten_topics ver 1.0.2 by Micogian start -->
<table class="tablebg" width="100%" cellspacing="1">
<tr>
	<th style="width: 34%">Ultimi topics</th>
	<th style="width: 33%">Topics pi&ugrave; visti</th>
	<th>Ultimi posts</th>
</tr>
<!-- BEGIN topten_list -->
<tr class= "row1"> 
	<td width="34%">{topten_list.LAST_TOPIC_DATA} &nbsp;<a style="font-weight: bold" href="{topten_list.LAST_TOPIC_LINK}" title="{topten_list.LAST_TOPIC_TITLE} (in: {topten_list.LAST_TOPIC_FORUM})">{topten_list.LAST_TOPIC_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.LAST_TOPIC_AUTHOR})</span></td>
	<td width="33%">{topten_list.VIEW_TOPIC_VIEWS} &nbsp;<a style="font-weight: bold" href="{topten_list.VIEW_TOPIC_LINK}" title="{topten_list.VIEW_TOPIC_TITLE} (in: {topten_list.VIEW_TOPIC_FORUM})">{topten_list.VIEW_TOPIC_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.VIEW_TOPIC_AUTHOR})</span></td>
	<td><a style=" font-weight: bold" href="{topten_list.LAST_POST_LINK}" title="{topten_list.LAST_POST_TITLE} (in: {topten_list.LAST_POST_FORUM})">{topten_list.LAST_POST_TITLE_SHORT}</a> <span style="color: #708090">(di {topten_list.LAST_POST_AUTHOR})</span></td>					
</tr>
<!-- END topten_list -->
<br />
</table>

<br clear="all" />
<!--  Mod topten_topics ver 1.0.2 by Micogian end -->
4) Modifica index_body.html

APRI: index_body.html
TROVA:

Codice: Seleziona tutto

<!-- INCLUDE forumlist_body.html -->
INSERISCI: dopo

Codice: Seleziona tutto

<!-- INCLUDE mod_topten_topics_body.html -->
Se vogliamo inserire la tabella prima dell'indice dei Forum l'include lo mettiamo prima.

Modifica effettuata il 12/12/2010

Avatar utente
Haku
Utente
Utente
Messaggi: 2529
Iscritto il: 22/09/2009, 22:36
Sesso: Maschio
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: [DEV] Mod Topten Topics ver 1.0.2

Messaggio da Haku » 12/12/2010, 2:45

Bingo,hai anche sotto mano la modifica per subsilver?O provo a modificare e poi la posto io? =)

Avatar utente
Micogian
Leader Programmatori
Leader Programmatori
Messaggi: 3704
Iscritto il: 07/01/2010, 8:51
Versione: 3.2.0
Server: UNIX/Linux
PHP: 5.4.36
Database: MySQL 5.1.70-log
Località: Udine
Contatta:

Re: [DEV] Mod Topten Topics ver 1.0.2

Messaggio da Micogian » 12/12/2010, 4:58

Inserita anche la versione per subsilver2.
Se vogliamo eliminare le righe di divisione nella tabella va cambiata la class="row1".

Avatar utente
Carlo
Amministratore
Amministratore
Messaggi: 9957
Iscritto il: 19/04/2009, 10:24
Sesso: Maschio
Versione: 3.2.0
Server: UNIX/Linux
PHP: 7.1.0
Database: MySQL(i) 10.0.27-MariaDB-cll-lve
Località: Puglia
Contatta:

Re: [DEV] Mod Topten Topics ver 1.0.2

Messaggio da Carlo » 02/05/2011, 13:13

MODs | Stili | Traduzioni MOD
Ogni MP contenente una richiesta di supporto verrà ignorato.

Bloccato

Torna a “MOD Rilasciate”

Chi c’è in linea

Visitano il forum: Nessuno e 16 ospiti