viewing paste Unknown #6850 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
Bom vamos lá, esse tutorial é baseado no tutorial do Adriano para o IPB 3.1.x de mesmo nome
 
Para iniciar, você deve pegar o arquivo ssi.php e a pasta ssi_templates dentro da pasta Tools do ZIP do IP.Board baixado da IPS
 
Então você precisa modificar o ssi.php e criar um template para que funcione corretamente
 
Abra o arquivo ssi.php e encontre:
 
case 'stats':
$this->_doStats();
break;
Adicione abaixo:
 
case 'topics':
$this->_doTopics();
break;
Encontre:
 
/**
* Do Stats
*
* Show totals
*/
function _doStats() 
{
Insira ACIMA
 
/*
        * Do Topics
        *
        * 10 Últimos Tópicos, por Adriano (SOS Invision)
        */
        function _doTopics()
        {
                //----------------------------------------
                // INIT
                //----------------------------------------
                
                $forum = 2;
                $topicos = 10;
                $to_echo = "";
                
                //-----------------------------------------
                // Load the template...
                //-----------------------------------------
                
                $template = $this->_loadTemplate("topics.html");
                        
                //-----------------------------------------
                // Get the topics, member info and other stuff
                //-----------------------------------------
                
                $this->DB->build( array( 'select' => '*',
                                                         'from'         => array( 'topics' => 't', 'profile_portal' => 'p' ),
                                                         'where'        => "t.forum_id={$forum} AND t.approved=1 AND p.pp_member_id=t.starter_id",
                                                         'order'        => 't.tid DESC',
                                                         'limit'        => array( 0, $topicos )
                ) );
                
                $o = $this->DB->execute();
                
                while ( $row = $this->DB->fetch( $o ) )
                {       
                        /* Generate the output */
                        $to_echo .= $this->_parseTemplate( $template, array ( 'photo' => $this->settings['board_url']."/uploads/{$row['pp_thumb_photo']}", 'date' => $this->registry->getClass('class_localization')->getDate( $row['start_date'], 'LONG' ), 'sid' => $this->settings['base_url']."showuser={$row['starter_id']}", 'starter' => $row['starter_name'], 'lid' => $this->settings['base_url']."showuser={$row['starter_id']}", 'last_poster' => $row['last_poster_name'],  'title' => $row['title'], 'id'   => $this->settings['base_url']."showtopic={$row['tid']}" ) );
                  }
        
                echo $to_echo;
                
                exit();
        }
 
Salve as modificações
 
Abra a pasta ssi_templates e crie um arquivo chamado topics.html
 
Insira esse conteúdo:
 
<style>
a, a:link {text-decoration: none; color: blue; }
a:hover { text-decoration: none; color: red; }
a:active { text-decoration: underline;}
.photo {
border-radius: 2px;
border:1px solid black;
height: 30px;
width: auto;
margin-top: 1px;
margin-right: 0px;
margin-bottom: -11px;
margin-left: 0px;
align: center;
}
.box {
  box-shadow: rgba(0,0,0,0.4) 2px 2px;
border-radius: 5px;
            border: 2px solid rgba(0,0,0,0.4);
line-height: 34px;
height: 34px;
margin-top: 5px;
}
.text {
margin-left: 7px;
font-family: Arial, Verdana;
font-size: 14px;
font-color: grey;
}
</style><div class="box"><div class="text">Postado por: <img src="{photo}" class="photo">  <a href='{sid}'>{starter}</a> | Tópico: <a id='demo' target='_blank' href='{id}' title='{title}'>{title}</a> | Em: {date} | Ultimo Por: {last_poster}</div></div>
 
Salve o arquivo
 
Entre no seu fórum, e digite na url, após o dominio (ex: www.exemplo.com/forum/ssi.php?a=topics)
 
E veja o resultado
 
Imagem Postada
 
Ainda no arquivo ssi.php não esqueça de configurar o fórum de onde serão mostrados os tópicos e a quantidade, em $forum e $topicos respectivamente :)
 
Outra opções validas para se mostrar são stats e active (stats vai mostrar o status do fórum e active vai mostrar os usuários ativos)
Viewed 739 times, submitted by Guest.