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

Topten Topics

Forum contenente i topic di tutte le MODs rilasciate nel nostro forum.
Possono essere scaricate anche tramite phpBBItalia.net Downloader.
metal master
Utente
Utente
Messaggi: 122
Iscritto il: 28/12/2010, 10:58
Sesso: Maschio
Versione: 3.1.3
Server: UNIX/Linux
PHP: 5.5.25
Database: MySQL(i) 5.5.43-37.2

Re: Topten Topics

Messaggio da metal master » 16/09/2011, 12:05

Adesso metto i passaggi che ho fatto:

creato file mod_lastpost_32.php con questo contenuto:

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_32 = 10 ;   // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
    $list_view_32 = 5 ;  // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics

    //---------- 10 Ultimi posts start -----------//
    $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_poster_colour,
       tt.topic_last_post_subject, tt.topic_last_post_time, tt.topic_replies, tt.topic_views, tt.topic_poster, tt.topic_first_poster_name, tt.topic_first_poster_colour,
        ft.forum_id, ft.forum_name
        FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
        WHERE tt.forum_id = 32
        AND 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_32";
    $result = $db->sql_query($sql);
        $n = 0;
        while ($row = $db->sql_fetchrow($result))
        {
              if ($auth->acl_get('f_read', $row['forum_id']) == 1)
            {
                if ($n < $list_view_32)
             {
                // accorcia il titolo se troppo lungo
                $post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
                if (strlen($post_subject) > 60)
                {
                $post_title = substr($post_subject,0,57) . "...";
                }else{
                $post_title = $post_subject ;
                }
                // accorcia il nome del Forum se troppo lungo
                $forum_title = $row['forum_name'];
                if (strlen($forum_title) > 28)
                {
                $forum_name_short = substr($forum_title,0,25) . "...";
                }else{
                $forum_name_short = $forum_title ;
                }
             $last_post_link[$n]                = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_id'] . "#p" . $row['topic_last_post_id']);
             $last_post_title[$n]             = $row['topic_last_post_subject'];
             $last_post_title_short[$n]          = $post_title;
             $last_post_forum_id[$n]           = $row['forum_id'];
             $last_post_forum_name[$n]           = $row['forum_name'];
             $last_post_forum_name_short[$n]     = $forum_name_short ;
             $last_post_last_poster_full[$n]    = get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
             $last_post_replies[$n]            = $row['topic_replies'];
             $last_post_views[$n]                = $row['topic_views'];
             $last_post_time[$n]                = $user->format_date($row['topic_last_post_time']);
             //echo $last_post_title_short[$n] . "<br />";
             ++$n ;             
             }else{
             break ;
             }
            }
        }
    //---------- 10 Ultimi posts end -----------//

    // Crea l'array "lastpost_list" che contiene le Variabili per il Template
    for ($x = 0; $x < $list_view_32; ++$x)
    {
    $template->assign_block_vars('lastpost_32',array(
       '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_ID'         => $last_post_forum_id[$x],
       'LAST_POST_FORUM_NAME'         => $last_post_forum_name[$x],
       'LAST_POST_FORUM_NAME_SHORT'   => $last_post_forum_name_short[$x],
       'LAST_POST_LAST_POSTER_FULL'   => $last_post_last_poster_full[$x],
       'LAST_POST_REPLIES'            => $last_post_replies[$x],
       'LAST_POST_VIEWS'            => $last_post_views[$x],
       'LAST_POST_TIME'            => $last_post_time[$x],
       ));
    }
?>
nel file index.php ho aggiunto sopra al primo include questo
include($phpbb_root_path . 'mod_lastpost_32.' . $phpEx);

Ho creato il file mod_lastpost32_body.html con il seguente contenuto

Codice: Seleziona tutto

<div class="forabg">
          <div class="inner"><span class="corners-top"><span></span></span>
             <ul class="topiclist">
                <li class="header">
                   <dl>
                      <dt style="text-align: left; width: 38%;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ultimi Posts</dt>
                      <dd style="text-align: left; width: 14%;">&nbsp;Nome del Forum</dd>
                      <dd style="text-align: center; width: 7%;">&nbsp;{L_REPLIES}</dd>
                      <dd style="text-align: center; width: 7%;">&nbsp;{L_VIEWS}</dd>               
                      <dd style="text-align: left; width: 13%;">&nbsp;Ultimo Messaggio</dd>
                      <dd style="text-align: left;">&nbsp;Data</dd>
                   </dl>
                </li>
             </ul>
             <!-- BEGIN lastpost_32 -->
             <ul class="topiclist forums">     
                <li>
                   <dl>
                      <dt style="text-align: left; width: 38%;"><a href="{lastpost_list.LAST_POST_LINK}"><b>{lastpost_list.LAST_POST_TITLE_SHORT}</b></a></dt>                                   
                      <dd style="text-align: left; width: 14%;"><a href="viewforum.php?f={lastpost_list.LAST_POST_FORUM_ID}">{lastpost_list.LAST_POST_FORUM_NAME_SHORT}</a></dd>                                   
                      <dd style="text-align: center; width: 7%">{lastpost_list.LAST_POST_REPLIES}</dd>
                      <dd style="text-align: center; width: 7%;">{lastpost_list.LAST_POST_VIEWS}</dd>
                      <dd style="text-align: left;  width: 13%;">{lastpost_list.LAST_POST_LAST_POSTER_FULL}</dd>
                      <dd style="text-align: left;">{lastpost_list.LAST_POST_TIME}</dd>
                   </dl>
                </li>
             </ul>
             <!-- END lastpost_32 -->
             <span class="corners-bottom"><span></span></span>
          </div>
       </div>

ho messo <!-- INCLUDE mod_lastpost32_body.html --> nell'overall header dove volevo far apparire la tabella.


La tabella appare ma e' senza contenuto

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: Topten Topics

Messaggio da Micogian » 16/09/2011, 13:04

Ovvio, come si chiama il nuovo array ? si chiama lastpost_32
Come si chiamano le variabili ? come prima ma con un piccolo particolare, è cambiato il nome dell'array.

Saranno quindi {lastpost_32.LAST_POST_LINK}, {lastpost_32.LAST_POST_TITLE_SHORT}, ecc. e cioè {nome_array.NOME_VARIABILE}

Mi dirai: "ma perchè non mi hai fatto un esempio completo dei file da creare? ", sarebbe stato più semplice.
La risposta è altrettanto semplice: spero che in questo modo ci si renda conto di cosa fa una query e come si possa utilizzare i dati che vengono passati.
Credo che sia molto meglio cercare di capire cosa si sta facendo piuttosto che copiare un codice semplicemente perchè ti dicono di copiarlo.

metal master
Utente
Utente
Messaggi: 122
Iscritto il: 28/12/2010, 10:58
Sesso: Maschio
Versione: 3.1.3
Server: UNIX/Linux
PHP: 5.5.25
Database: MySQL(i) 5.5.43-37.2

Re: Topten Topics

Messaggio da metal master » 16/09/2011, 14:23

bingo puoi controllare se ho modificato bene il file 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_32 = 10 ;   // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
    $list_view_32 = 5 ;  // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics

    //---------- 10 Ultimi posts start -----------//
    $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_poster_colour,
       tt.topic_last_post_subject, tt.topic_last_post_time, tt.topic_replies, tt.topic_views, tt.topic_poster, tt.topic_first_poster_name, tt.topic_first_poster_colour,
        ft.forum_id, ft.forum_name
        FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
        WHERE tt.forum_id = 32
        AND 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_32";
    $result = $db->sql_query($sql);
        $n = 0;
        while ($row = $db->sql_fetchrow($result))
        {
              if ($auth->acl_get('f_read', $row['forum_id']) == 1)
            {
                if ($n < $list_view_32)
             {
                // accorcia il titolo se troppo lungo
                $post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
                if (strlen($post_subject) > 60)
                {
                $post_title = substr($post_subject,0,57) . "...";
                }else{
                $post_title = $post_subject ;
                }
                // accorcia il nome del Forum se troppo lungo
                $forum_title = $row['forum_name'];
                if (strlen($forum_title) > 28)
                {
                $forum_name_short = substr($forum_title,0,25) . "...";
                }else{
                $forum_name_short = $forum_title ;
                }
             $lastpost_32.last_post_link[$n]                = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_32_id'] . "#p" . $row['topic_last_post_32_id']);
             $lastpost_32.last_post_title[$n]             = $row['topic_last_post_subject'];
             $lastpost_32.last_post_title_short[$n]          = $post_title;
             $lastpost_32.last_post_forum_id[$n]           = $row['forum_id'];
             $lastpost_32.last_post_forum_name[$n]           = $row['forum_name'];
             $lastpost_32.last_post_forum_name_short[$n]     = $forum_name_short ;
             $lastpost_32.last_post_last_poster_full[$n]    = get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
             $lastpost_32.last_post_replies[$n]            = $row['topic_replies'];
             $lastpost_32.last_post_views[$n]                = $row['topic_views'];
             $lastpost_32.last_post_time[$n]                = $user->format_date($row['topic_last_post_time']);
             //echo $last_post_title_short[$n] . "<br />";
             ++$n ;             
             }else{
             break ;
             }
            }
        }
    //---------- 10 Ultimi posts end -----------//

    // Crea l'array "lastpost_list" che contiene le Variabili per il Template
    for ($x = 0; $x < $list_view_32; ++$x)
    {
    $template->assign_block_vars('lastpost_32',array(
       'lastpost_32.LAST_POST_LINK'            => $last_post_link[$x],
       'lastpost_32.LAST_POST_TITLE'            => $last_post_title[$x],
       'lastpost_32.LAST_POST_TITLE_SHORT'         => $last_post_title_short[$x],
       'lastpost_32.LAST_POST_FORUM_ID'         => $last_post_forum_id[$x],
       'lastpost_32.LAST_POST_FORUM_NAME'         => $last_post_forum_name[$x],
       'lastpost_32.LAST_POST_FORUM_NAME_SHORT'   => $last_post_forum_name_short[$x],
       'lastpost_32.LAST_POST_LAST_POSTER_FULL'   => $last_post_last_poster_full[$x],
       'lastpost_32.LAST_POST_REPLIES'            => $last_post_replies[$x],
       'lastpost_32.LAST_POST_VIEWS'            => $last_post_views[$x],
       'lastpost_32.LAST_POST_TIME'            => $last_post_time[$x],
       ));
    }
?>

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: Topten Topics

Messaggio da Micogian » 16/09/2011, 15:45

Mi sembra tutto assurdo, credevo di avere spiegato.
Io mi riferivo al valore da usare nel template, non nel php, quello era a posto
Il nome dell'array è dichiarato nella riga

Codice: Seleziona tutto

 $template->assign_block_vars('lastpost_32',array(
e va usato solamente nel template.

Ho detto fin dall'inizio: devi indicare dove (WHERE) cercare i dati e modificare il nome dell'array.
Al limite cambiamo il nome delle variabili $list_rec e $list_view per non confonderci con l'altra Mod.
Tutto li.

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_32 = 10 ;   // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
    $list_view_32 = 5 ;  // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics

    //---------- 10 Ultimi posts start -----------//
    $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_poster_colour,
       tt.topic_last_post_subject, tt.topic_last_post_time, tt.topic_replies, tt.topic_views, tt.topic_poster, tt.topic_first_poster_name, tt.topic_first_poster_colour,
        ft.forum_id, ft.forum_name
        FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
        WHERE tt.forum_id = 32
        AND 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_32";
    $result = $db->sql_query($sql);
        $n = 0;
        while ($row = $db->sql_fetchrow($result))
        {
              if ($auth->acl_get('f_read', $row['forum_id']) == 1)
            {
                if ($n < $list_view_32)
             {
                // accorcia il titolo se troppo lungo
                $post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
                if (strlen($post_subject) > 60)
                {
                $post_title = substr($post_subject,0,57) . "...";
                }else{
                $post_title = $post_subject ;
                }
                // accorcia il nome del Forum se troppo lungo
                $forum_title = $row['forum_name'];
                if (strlen($forum_title) > 28)
                {
                $forum_name_short = substr($forum_title,0,25) . "...";
                }else{
                $forum_name_short = $forum_title ;
                }
             $llast_post_link[$n]                = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_32_id'] . "#p" . $row['topic_last_post_32_id']);
             $last_post_title[$n]             = $row['topic_last_post_subject'];
             $last_post_title_short[$n]          = $post_title;
             $last_post_forum_id[$n]           = $row['forum_id'];
             $last_post_forum_name[$n]           = $row['forum_name'];
             $last_post_forum_name_short[$n]     = $forum_name_short ;
             $last_post_last_poster_full[$n]    = get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
             $last_post_replies[$n]            = $row['topic_replies'];
             $last_post_views[$n]                = $row['topic_views'];
             $last_post_time[$n]                = $user->format_date($row['topic_last_post_time']);
             ++$n ;             
             }else{
             break ;
             }
            }
        }
    //---------- 10 Ultimi posts end -----------//

    // Crea l'array "lastpost_list" che contiene le Variabili per il Template
    for ($x = 0; $x < $list_view_32; ++$x)
    {
    $template->assign_block_vars('lastpost_32',array(
       '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_ID'         => $last_post_forum_id[$x],
       'LAST_POST_FORUM_NAME'         => $last_post_forum_name[$x],
       'LAST_POST_FORUM_NAME_SHORT'   => $last_post_forum_name_short[$x],
       'LAST_POST_LAST_POSTER_FULL'   => $last_post_last_poster_full[$x],
       'LAST_POST_REPLIES'            => $last_post_replies[$x],
       'LAST_POST_VIEWS'            => $last_post_views[$x],
       'LAST_POST_TIME'            => $last_post_time[$x],
       ));
    }
?>

metal master
Utente
Utente
Messaggi: 122
Iscritto il: 28/12/2010, 10:58
Sesso: Maschio
Versione: 3.1.3
Server: UNIX/Linux
PHP: 5.5.25
Database: MySQL(i) 5.5.43-37.2

Re: Topten Topics

Messaggio da metal master » 16/09/2011, 16:00

mi esce

Codice: Seleziona tutto

[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 68: Undefined variable: last_post_link
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 68: Undefined variable: last_post_link
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 68: Undefined variable: last_post_link
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 68: Undefined variable: last_post_link
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 68: Undefined variable: last_post_link
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4592: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4594: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4595: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4596: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)

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: Topten Topics

Messaggio da Micogian » 16/09/2011, 16:33

Riga 46: è sbagliato il nome della variabile, non $llast_post_link[$n] ma $last_post_link[$n] (c'è una 'l' di troppo).
Poi fai attenzione, se hai copiato il codice dal post precedente è probabile che ci siano degli spazi iniziali nel file.
Il tag iniziale <?php non deve contenere nessuno spazio o tab iniziali.

metal master
Utente
Utente
Messaggi: 122
Iscritto il: 28/12/2010, 10:58
Sesso: Maschio
Versione: 3.1.3
Server: UNIX/Linux
PHP: 5.5.25
Database: MySQL(i) 5.5.43-37.2

Re: Topten Topics

Messaggio da metal master » 16/09/2011, 16:41

modificato ma da sempre lo stesso errore

Codice: Seleziona tutto

[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Notice: in file /mod_lastpost_32.php on line 46: Undefined index: topic_last_post_32_id
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4592: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4594: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4595: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4596: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)

questo e' il codice 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_32 = 10 ;   // numero di records da estrarre dalla tabella (alcuni topics potrebbero non aver il permesso di lettura)
        $list_view_32 = 5 ;  // sostituire il numero della variabile $lista se si desidera diminuire/aumentare il numero dei Topics

        //---------- 10 Ultimi posts start -----------//
        $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_poster_colour,
           tt.topic_last_post_subject, tt.topic_last_post_time, tt.topic_replies, tt.topic_views, tt.topic_poster, tt.topic_first_poster_name, tt.topic_first_poster_colour,
            ft.forum_id, ft.forum_name
            FROM " . TOPICS_TABLE . " tt, " . FORUMS_TABLE . " ft
            WHERE tt.forum_id = 32
            AND 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_32";
        $result = $db->sql_query($sql);
            $n = 0;
            while ($row = $db->sql_fetchrow($result))
            {
                  if ($auth->acl_get('f_read', $row['forum_id']) == 1)
                {
                    if ($n < $list_view_32)
                 {
                    // accorcia il titolo se troppo lungo
                    $post_subject = str_replace("Re: ", "", $row['topic_last_post_subject']) ;
                    if (strlen($post_subject) > 60)
                    {
                    $post_title = substr($post_subject,0,57) . "...";
                    }else{
                    $post_title = $post_subject ;
                    }
                    // accorcia il nome del Forum se troppo lungo
                    $forum_title = $row['forum_name'];
                    if (strlen($forum_title) > 28)
                    {
                    $forum_name_short = substr($forum_title,0,25) . "...";
                    }else{
                    $forum_name_short = $forum_title ;
                    }
                 $last_post_link[$n]             = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_32_id'] . "#p" . $row['topic_last_post_32_id']);
                 $last_post_title[$n]             = $row['topic_last_post_subject'];
                 $last_post_title_short[$n]          = $post_title;
                 $last_post_forum_id[$n]           = $row['forum_id'];
                 $last_post_forum_name[$n]           = $row['forum_name'];
                 $last_post_forum_name_short[$n]     = $forum_name_short ;
                 $last_post_last_poster_full[$n]    = get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
                 $last_post_replies[$n]            = $row['topic_replies'];
                 $last_post_views[$n]                = $row['topic_views'];
                 $last_post_time[$n]                = $user->format_date($row['topic_last_post_time']);
                 ++$n ;             
                 }else{
                 break ;
                 }
                }
            }
        //---------- 10 Ultimi posts end -----------//

        // Crea l'array "lastpost_list" che contiene le Variabili per il Template
        for ($x = 0; $x < $list_view_32; ++$x)
        {
        $template->assign_block_vars('lastpost_32',array(
           '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_ID'         => $last_post_forum_id[$x],
           'LAST_POST_FORUM_NAME'         => $last_post_forum_name[$x],
           'LAST_POST_FORUM_NAME_SHORT'   => $last_post_forum_name_short[$x],
           'LAST_POST_LAST_POSTER_FULL'   => $last_post_last_poster_full[$x],
           'LAST_POST_REPLIES'            => $last_post_replies[$x],
           'LAST_POST_VIEWS'            => $last_post_views[$x],
           'LAST_POST_TIME'            => $last_post_time[$x],
           ));
        }
?>

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: Topten Topics

Messaggio da Micogian » 16/09/2011, 16:50

Non avevo notato un altro errore.
avevi modificato questa riga, ma il nome del campo 'topic_last_post_32_id' non esiste:

Codice: Seleziona tutto

$last_post_link[$n]             = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_32_id'] . "#p" . $row['topic_last_post_32_id']);
Dovevi lasciare com'era in origine:

Codice: Seleziona tutto

$last_post_link[$n]             = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=" . $row['forum_id'] . "&t=" . $row['topic_id'] . "&p=" . $row['topic_last_post_id'] . "#p" . $row['topic_last_post_id']);

metal master
Utente
Utente
Messaggi: 122
Iscritto il: 28/12/2010, 10:58
Sesso: Maschio
Versione: 3.1.3
Server: UNIX/Linux
PHP: 5.5.25
Database: MySQL(i) 5.5.43-37.2

Re: Topten Topics

Messaggio da metal master » 16/09/2011, 17:04

messo a posto la riga,ora non appaiono errori ma non appare nemmeno il contenuto nella tabella.

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: Topten Topics

Messaggio da Micogian » 16/09/2011, 19:05

Ammesso che il file php funzioni dovrei vedere il template.

Rispondi

Torna a “Database MODs”

Chi c’è in linea

Visitano il forum: Nessuno e 3 ospiti