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

Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Cerchi una MOD? Chiedi in questo forum.
Questa sezione è supportata dagli utenti del forum, pertanto lo Staff potrebbe non eseguire tali richieste.
Rispondi
Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 10/08/2011, 20:00

Codice: Seleziona tutto

Last Post Under Forum Description
This hack will place the last post information under the forum description on your index page, including the topic title, the date and time of the last person and the person who made the post.

Requires the Last Post Topic on Index.
funzionava per phpbb2, in pratica alla fine del forum dove ci sono "chi c'è in linea" o "statistiche" si poteva inserire un codice che faceva una query il cui risultato era:
Ultimo post scritto da Tizio alle ore 12:34 del 01/01/2011
Cliccando su ultimo post ti indirizzava direttamente al topic mentre cliccando sul nick ti apriva il suo profilo

per phpbb3 fin'ora ho trovato solo mod per inserire tutto l'ultimo topic da qualche parte o simili

allego il codice della mod per phpbb2:

Codice: Seleziona tutto

############################################################## 
## MOD Title: Last Post under Forum description [2.0.17] 
## MOD Author:    getout < getout@hotmail.com > 
## 
## MOD Description: This mod will place the Last post under the forum description in index_body just as vbulletin style.
##		    "Topic on Index" mod by e-sven(http://www.phpbbhacks.com/download/566) should be installed first before using this mod 
## 
## MOD Version: 1.0.0 
## 
## Installation Level: (Easy) 
## Installation Time: 1 Minute 
## Files To Edit: (1) 
##	- index.php
##      - templates/subSilver/index_body.tpl 
##	- templates/subSilver/subSilver.css
## Included Files: (n/a) 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: http://www.phpbb.com/mods/ 
############################################################## 
## Author Notes: Empty 'REPLACE WITH' codes means remove the line.
##		 "Topic on Index" mod should be installed before using this mod.
##
############################################################## 
## MOD History: 
## 
##   2005-09-04 - Version 1.0.0 
##      - First version released ! 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ OPEN ]------------------------------------------ 
# 
index.php

# 
#-----[ FIND ]------------------------------------------ 
# 
							$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
							$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
							$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
							$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
							$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
							$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a>&nbsp;' . on . '&nbsp;';
							$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a>' . by . '&nbsp;';
							$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';

# 
#-----[ OPEN ]------------------------------------------ 
#
templates/subSilver/index_body.tpl

# 
#-----[ FIND ]------------------------------------------ 
#
	<th class="thCornerR" nowrap="nowrap">&nbsp;{L_LASTPOST}&nbsp;</th>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
#


# 
#-----[ FIND ]------------------------------------------ 
# 
	<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>

# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 

#
#-----[ FIND ]------------------------------------------ 
#
	  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>

#
#-----[ REPLACE WITH ]------------------------------------------
#
	  </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}<br />
	  </span><span class="bound"><b>Last Post</b> : {catrow.forumrow.LAST_POST}<br /></span></td>

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/subSilver.css

#
#-----[ FIND ]------------------------------------------
#
.quote {
	font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; color: #444444; line-height: 125%;
	background-color: #FAFAFA; border: #D1D7DC; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}

#
#-----[ AFTER, ADD ]------------------------------------------
#
.bound {
	font-family:  Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000; line-height: 200%;
	background-color: #FFFFFF; border: #D1D7DC; border-style: dashed;
	border-left-width: 1px; border-top-width:1 px; border-right-width: 1px; border-bottom-width: 1px
}

# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM
per funzionare aveva bisogno di questa ulteriore mod:

Codice: Seleziona tutto

##############################################################
## Mod Title:   shows topic of last made post on index
## Mod Version: 1.4.1
## Author:      e-sven <sven@e-sven.net> http://www.e-sven.net
## Description: -adds lasts post topic to each forum on
##               the index page (based on read-access)
##		-word censorship is used
##		-topic title with more then 27 chars are cut off
##		-mouseover info displays the full title
##
## Installation Level:  easy
## Installation Time:   2-5 Minutes
## Files To Edit:       index.php
## Included Files:      index.php (pre-modded)
##############################################################
## History:
##         1.4.1 Updated to phpBB 2.0.22
##         ???
##         0.9 not released beta
##         1.0 first working release
##         1.1 optimized db access
##	   1.2 made implementation easier 
##	       (only two replaces have to be made)
##         1.2a just a minor bug (thanks to Acid)
##         1.3 empty forums where not displayed correctly
##         1.4 optimized db-query
############################################################## 
## Before Adding This MOD To Your Forum, 
## You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ OPEN ]------------------------------------------------
#
index.php

#
#-----[ ACTION Find ]-----------------------------------------
#
			$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id
				FROM (( " . FORUMS_TABLE . " f
				LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )
				LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id )
				ORDER BY f.cat_id, f.forum_order";
			break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	while( $row = $db->sql_fetchrow($result) )
	{
		$forum_data[] = $row;
	}
	$db->sql_freeresult($result);

	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}


#
#-----[ REPLACE WITH ]----------------------------------------
#
 		$sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id, t.topic_title, t.topic_last_post_id " .
			" FROM ((( " . FORUMS_TABLE . " f " .
			" LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id )" .
			" LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) " .
			" LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_last_post_id = p.post_id ) " .
			" ORDER BY f.cat_id, f.forum_order";
		break;
	}
	if ( !($result = $db->sql_query($sql)) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
	}

	$forum_data = array();
	$topic_last_ary = array();
	$i=0;
	while( $row = $db->sql_fetchrow($result) )
	{
		if (!in_array($row['topic_last_post_id'], $topic_last_ary) || $row['topic_last_post_id']==0) {
			$topic_last_ary[i]=$row['topic_last_post_id'];
			$i++;
			$forum_data[] = $row;
		}
	}
	unset($topic_last_ary);
	if ( !($total_forums = count($forum_data)) )
	{
		message_die(GENERAL_MESSAGE, $lang['No_forums']);
	}
	
	//
	// Filter topic_title not allowed to read
	// 
	if ( !($userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ) {
		$auth_read_all = array();
		$auth_read_all=auth(AUTH_READ, AUTH_LIST_ALL, $userdata, $forum_data);
		$auth_data = '';
		for($i=0; $i<count($forum_data); $i++)
		{
			if (!$auth_read_all[$forum_data[$i]['forum_id']]['auth_read']) {
				$forum_data[$i]['topic_title']='';
			}
		}
	}

	//
	// Define censored word matches
	//
	$orig_word = array();
	$replacement_word = array();
	obtain_word_list($orig_word, $replacement_word);


#
#-----[ ACTION Find ]-----------------------------------------
#
							if ( $forum_data[$j]['forum_last_post_id'] )
							{
								$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);

								$last_post = $last_post_time . '<br />';

								$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
								
								$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
							}


#
#-----[ ACTION Replace With ]---------------------------------
#
	if ( $forum_data[$j]['forum_last_post_id'] )
	{
		$topic_title = $forum_data[$j]['topic_title'];
		$topic_title2 = $forum_data[$j]['topic_title'];
		
		//
		// Censor topic title
		//
		if ( count($orig_word) )
		{
			$topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
			$topic_title2 = preg_replace($orig_word, $replacement_word, $topic_title2);
		}
										
		if (strlen($topic_title)>27) {
			$topic_title = substr($topic_title,0,24) . '...';
		}

		$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
		$last_post = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '" title="' . $topic_title2 . '">' . $topic_title . '</a><br>';
		$last_post .= $last_post_time . '&nbsp;<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '"></a><br>' . $lang['by'] . '&nbsp;';
		$last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> ';
	}

#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------------
#
di php ed sql non ci capisco nulla, qualcuno mi può dare una mano con questa mod?
grazie

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: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Micogian » 10/08/2011, 20:38

La Mod Topten Topics visualizza la Lista degli ultimi 10 Topics. i 10 più visti e gli ultimi 10 posts.
Ora basta prendere l'ultima parte, quella che riguarda gli ultimi posts, ridurre il numero dei posts a 1 e il gioco è fatto.
Semplice semplice, tra l'altro senza bisogno di modificare l'index, in quanto la mod prevede che il codice sia scritto in un altro file e inserito con un "include".
In pratica basta fare qualche modifica, ad esempio creare un file di nome 'mod_last_post.php' da inserire nella root del Forum.
Questo il contenuto:

Codice: Seleziona tutto

<?php
if (!defined('IN_PHPBB'))
{
   exit;
}
//---------- Mod Last Post start  by Bingo-Micogian-----------//
$sql = "SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time, tt.topic_last_poster_colour,
    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_last_post_time DESC LIMIT 0,5";
$result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result))
    {
       	if ($auth->acl_get('f_read', $row['forum_id']) == 1) 
        {
				$post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
				if (strlen($post_subject) > 30)
				{
				$post_title_short = substr($post_subject,0,27) . "...";
				}else{
				$post_title_short = $post_subject ;
				}
				$template->assign_block_vars('mod_last_post',array(
					'MOD_LAST_POST'			=> true ,
					'MOD_LAST_POST_LINK'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "#p" . $row['topic_last_post_id']),
					'MOD_LAST_POST_TITLE'			=> $row['topic_last_post_subject'],
					'MOD_LAST_POST_TITLE_SHORT'		=> $post_title_short,
					'MOD_LAST_POST_FORUM'			=> $row['forum_name'],
					'MOD_LAST_POST_AUTHOR'			=> $row['topic_last_poster_name'],
					'MOD_LAST_POST_AUTHOR_FULL'  	=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
					));
			break ;
			}
    }
//---------- Mod Last Post end -----------//
?>
nel file index.php si inserisce la seguente riga, prima di // Output page

Codice: Seleziona tutto

include($phpbb_root_path . 'mod_last_post.' . $phpEx);
A questo punto abbiamo a disposizione l'array last_post che possiamo usare nel template index_body.html con tutti i dati necessati: Titolo del Post (anche short), nome dell'autore (colorato), nome del Forum e link al post.

ATTENZIONE: la query estrae 5 records dalla tabella topics perchè c'è poi un controllo che stabilisce se l'utente ha i permessi di lettura del Post stesso, quindi prima c'è il controllo, se passa il Post viene archiviato e la procedura termina, altrimenti si passa al successivo Topic.
In sostanza l'ultimo Post potrebbe essere diverso a seconda dell'utente.

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 0:15

grazie del supporto
sono quasi riuscito ad ottenere quello che volevo
ci_sono_quasi.png
ora mi manca solo che, quando clicco sul nick dell'autore, si apra il suo profilo e non l'indice del forum.

da quello che ho capito dovrei modificare il file mod_topten_topics.php per aggiungere una variabile all'array tipo

Codice: Seleziona tutto

'LAST_POST_AUTHOR_LINK'			=> $last_post_author_link[$x],
giusto?
Non hai i permessi necessari per visualizzare i file allegati in questo messaggio.

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 0:33

ho trovato verso la riga 647 del file viewforum.php
la seguente stringa

Codice: Seleziona tutto

'LAST_POST_AUTHOR_FULL'		=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
come faccio ad usarla per i miei scopi?

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 2:16

non so come cavolo ho fatto però sembra funzionare
visto che (da quello che ho capito) ho fatto delle query al db e non vorrei mai aver aperto qualche falla posso chiedervi di dare un'occhiata ha quello che ho fatto ed eventualmente correggere i miei errori?

Grazie.


Veniamo alle modifiche:
questo è il mio mod_topten_topics.php

Codice: Seleziona tutto

<?php
// MOD Topten Topics : Topics più recenti, Topics più visti e Posts più recenti 
// created by Micogian (Bingo)
if (!defined('IN_PHPBB'))
{
   exit;
}
// configurazione: numero dei recods da visualizzare nella Lista
$list_rec = 20 ;   // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
$list_view = 1 ;  // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics 

//---------- 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,$list_rec";
$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 < $list_view)
			{
				if (strlen($row1['topic_title']) > 60)
				{
				$topic_title1 = substr($row1['topic_title'],0,59) . "...";
				}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]			= $user->format_date($row1['topic_time'], "l d F Y").' alle '.$user->format_date($row1['topic_time'], "G:i");
			++$n1 ;          	
            }else{
			break ;
			}
        }
    }
//---------- 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,$list_rec";
$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 < $list_view)
			{
				if (strlen($row2['topic_title']) > 60)
				{
				$topic_title2 = substr($row2['topic_title'],0,59) . "...";
				}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 ;
			}else{
			break ;
			}
		}
	}
//---------- 10 Topics più visti end -----------//

//---------- 10 Ultimi posts start -----------//
$sql4 = "SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_last_post_time,
    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_last_post_time DESC LIMIT 0,$list_rec";
$result4 = $db->sql_query($sql4);
    $n4 = 0;
    while ($row4 = $db->sql_fetchrow($result4))
    {
       	if ($auth->acl_get('f_read', $row4['forum_id']) == 1) 
        {
            if ($n4 < $list_view)
			{
				$post_subject = str_replace("Re: ", "", $row4['topic_last_post_subject']) ;
				if (strlen($post_subject) > 60)
				{
				$post_title = substr($post_subject,0,59) . "...";
				}else{
				$post_title = $post_subject ;
				}
			$last_post_link[$n4]		= append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "#p" . $row4['topic_last_post_id']);
			//$last_post_link[$n4]   		= append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row4['forum_id'] . "&t=" . $row4['topic_id'] . "p#" . $row4['topic_last_post_id']);
			$last_post_title[$n4] 		= $row4['topic_last_post_subject'];
			$last_post_title_short[$n4] = $post_title;
			$last_post_forum[$n4]  		= $row4['forum_name'];
			$last_post_author[$n4] 		= $row4['topic_last_poster_name'];
			$last_post_author_link[$n4] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row4['topic_last_poster_id']);
			$last_post_data[$n4]		= $user->format_date($row4['topic_last_post_time'], "l d F Y").' alle '.$user->format_date($row4['topic_last_post_time'], "G:i");
			++$n4 ;          	
			}else{
			break ;
			}
        }
    }
//---------- 10 Ultimi posts end -----------//

// Crea l'array "topten_list" che contiene le Variabili per il Template
for ($x = 0; $x < $list_view; ++$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'			=> $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],

	'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],
	'LAST_POST_AUTHOR_LINK'		=> $last_post_author_link[$x],
	'LAST_POST_DATA'			=> $last_post_data[$x],	
	));
	
}
?>
Ho aggiunto alla fine un:
'LAST_POST_AUTHOR_LINK' => $last_post_author_link[$x],
'LAST_POST_DATA' => $last_post_data[$x],


ed un po' più su un:
$last_post_author_link[$n4] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row4['topic_last_poster_id']);
$last_post_data[$n4] = $user->format_date($row4['topic_last_post_time'], "l d F Y").' alle '.$user->format_date($row4['topic_last_post_time'], "G:i");


per avere la data completa dell'ultimo post:
$last_post_data[$n4] = $user->format_date($row4['topic_last_post_time'], "l d F Y").' alle '.$user->format_date($row4['topic_last_post_time'], "G:i");

per il resto ho solo cambiato alcuni valori per avere una sola riga (a me interessa l'ultimo topic, non gli ultimi 10) ed ho fatto in modo che se il titolo del topic supera i 27 (o 28) caratteri non venga troncato (ho portato i valori a 59/60)


ho eliminato il file mod_topten_topics_body.html che a me non serviva e nel file index_body.html ho aggiunto questa riga:

Codice: Seleziona tutto

                                <p class="genmed"><!-- BEGIN topten_list -->L'ultimo commento inviato è "<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>" inviato da <a style=" font-weight: bold" href="{topten_list.LAST_POST_AUTHOR_LINK}" title="{topten_list.LAST_POST_AUTHOR}">{topten_list.LAST_POST_AUTHOR}</a> {topten_list.LAST_POST_DATA}<!-- END topten_list --></p></td>
subito sotto a:
<td class="row1" width="100%" valign="middle"><p class="genmed">{TOTAL_POSTS} | {TOTAL_TOPICS} | {TOTAL_USERS} | {NEWEST_USER}</p>

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: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Micogian » 11/08/2011, 6:36

Il codice che ti ho postato è un adattamento della Mod Topten Topics e funziona perfettamente.
Nel template index_body,html, prima dell'ultima riga <!-- INCLUDE overall_footer.html --> ci metti una cosa del genere:

Codice: Seleziona tutto

<!-- BEGIN mod_last_post -->
<!-- IF mod_last_post.MOD_LAST_POST -->
	<h3>Ultimo post</h3>
	<a href="{mod_last_post.MOD_LAST_POST_LINK}" title="" />{mod_last_post.MOD_LAST_POST_TITLE}</a> in [ {mod_last_post.MOD_LAST_POST_FORUM} ] di {mod_last_post.MOD_LAST_POST_AUTHOR_FULL}
<!-- ENDIF -->
<!-- END mod_last_post -->
MOD_LAST_POST_LINK è il link alla discussione
MOD_LAST_POST_TITLE è il titolo della discussione
MOD_LAST_POST_FORUM è il nome del Forum dove si trova la discussione
MOD_LAST_POST_AUTHOR_FULL è il nome dell'utente colorato e linkabile.

Se poi vuoi metterlo in maniera diversa si può fare ma i dati sono quelli.

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 13:37

scusa, ieri con tutto il codice che ho maneggiato durante la giornata mi sono completamente rinc... e non mi sono accorto che il codice che mi avevi postato non era un copia/incolla della mod ufficiale ma proprio una mod fatta apposta per me :frustrante:

vedo di usare il tuo codice che è sicuramente più semplice e leggero di quello che ho usato io :sisi:

grazie ancora :ciao:

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 15:27

ecco il codice che ho usato (ho modificato il tuo aggiungendo la data e facendo in modo che la sezione del forum sia cliccabile inoltre il link al post visualizza il soggetto del topic e non del post così se qualcuno rispondendo lo lascia in bianco, lo cancella o modifica non visualizza uno spazio voto o un titolo che non è quello del topic stesso)

Codice: Seleziona tutto

<?php
if (!defined('IN_PHPBB'))
{
   exit;
}
//---------- Mod Last Post start  by Bingo-Micogian-----------//
$sql = "SELECT tt.topic_id, tt.forum_id, tt.topic_moved_id, tt.topic_last_post_id, tt.topic_last_poster_id, tt.topic_last_poster_name, tt.topic_last_post_subject, tt.topic_title, tt.topic_last_post_time, tt.topic_last_poster_colour,
    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_last_post_time DESC LIMIT 0,5";
$result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result))
    {
          if ($auth->acl_get('f_read', $row['forum_id']) == 1)
        {
            $post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
            if (strlen($post_subject) > 60)
            {
            $post_title_short = substr($post_subject,0,59) . "...";
            }else{
            $post_title_short = $post_subject ;
            }
            $template->assign_block_vars('mod_last_post',array(
               'MOD_LAST_POST'         			=> true ,
               'MOD_LAST_POST_LINK'        		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "#p" . $row['topic_last_post_id']),
               'MOD_LAST_POST_TITLE'         	=> $row['topic_title'],
               'MOD_LAST_POST_TITLE_SHORT'      => $post_title_short,
               'MOD_LAST_POST_FORUM_LINK'       => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=" . $row['forum_id']),
			   'MOD_LAST_POST_FORUM'         	=> $row['forum_name'],
               'MOD_LAST_POST_AUTHOR'        	=> $row['topic_last_poster_name'],
               'MOD_LAST_POST_AUTHOR_FULL'     	=> get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
			   'MOD_LAST_POST_DATA'				=> $user->format_date($row['topic_last_post_time'], "l d F Y").' alle '.$user->format_date($row['topic_last_post_time'], "G:i"),
               ));
         break ;
         }
    }
//---------- Mod Last Post end -----------//
?>
e questo è il codice che uso in index_body.html

Codice: Seleziona tutto

<p class="genmed"><!-- BEGIN mod_last_post --><!-- IF mod_last_post.MOD_LAST_POST -->L'ultimo commento inviato si trova in "<a style=" font-weight: bold" href="{mod_last_post.MOD_LAST_POST_LINK}" title="" />{mod_last_post.MOD_LAST_POST_TITLE}</a>" nella sezione "<a style=" font-weight: bold" href="{mod_last_post.MOD_LAST_POST_FORUM_LINK}" title="" />{mod_last_post.MOD_LAST_POST_FORUM}</a>" inviato da {mod_last_post.MOD_LAST_POST_AUTHOR_FULL} {mod_last_post.MOD_LAST_POST_DATA}<!-- ENDIF --><!-- END mod_last_post --></p>
questo è il risultato:
risultato.png

grazie di tutto :ciao:
Non hai i permessi necessari per visualizzare i file allegati in questo messaggio.

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: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Micogian » 11/08/2011, 15:38

Il link al Forum va bene, il dato è disponibile, quindi nessun problema.
Per la data ho qualche riserva sull'uso della stringa "alle" perchè la funzione di phpbb utilizza il format "x minuti fa, ieri, ecc.) per date recenti.

Master of Mouse
Utente
Utente
Messaggi: 22
Iscritto il: 23/04/2011, 17:26
Versione: 3.0.9
Server: UNIX/Linux
Contatta:

Re: Ultimo topic sotto "Chi c’è in linea" e "statistiche"

Messaggio da Master of Mouse » 11/08/2011, 16:13

che ne dici di questo:
'MOD_LAST_POST_DATA' => $user->format_date($row['topic_last_post_time'], "l d F Y \a\l\l\e G:i"),

mi sono ispirato all'esempio 2 presente su http://php.net/manual/en/function.date.php

Rispondi

Torna a “Richiesta MOD”

Chi c’è in linea

Visitano il forum: Nessuno e 44 ospiti