Un Evento Unico. 5 Sale. 27 Interventi. SEO, SOCIAL, E-Commerce, Mobile, Turismo.
CLICCA QUI e SCOPRI DI PIù X Chiudi
 
Forum GT: Condividiamo idee e conoscenza Forum GT: Condividiamo idee e conoscenza


Condividi questo contenuto nei Social Network:
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito.


Vai indietro   Forum per Webmaster: Condividiamo Idee e Conoscenza > Sviluppo e Gestione siti web > Php - Mysql
Benvenuto! Forum Regole FAQ Lista utenti Calendario Segna come letti


Rispondi
 
LinkBack Strumenti di discussione
Vecchio 23-04-06, 23:09   #1 (permalink)
User
 
L'avatar di EthanDane
 
Data di registrazione: Jun 2005
Messaggi: 429
Invia un messaggio tramite ICQ a EthanDane Invia un messaggio tramite MSN a EthanDane Invia un messaggio tramite Yahoo a EthanDane Invia un messaggio tramite Skype a EthanDane
Modifica a Script per gli ultimi 10 topic

Salve a tutti, per il mio forum di discussione phpBB uso un piccolo script che mi permette di stampare gli ultimi 10 topic.
Mi domandavo come faccio a non far apparire anche i topic privati? ossia quelli che riguardano i forum privati e non al pubblico?

Lo script è il seguente:
codice PHP:


Codice:
// Basic Configuration 
// How Many Topics you want to display? 
$topicnumber = 10; 
// Scrolling towards up or down? 
$scroll = "up"; 
// Change this to your phpBB path 
$urlPath = "http://www/forum"; 

// Database Configuration (Where your phpBB config.php file is located 
include './forum/config.php'; 

// Connecting & Selecting Databases 
$table_topics = $table_prefix. "topics"; 
$table_forums = $table_prefix. "forums"; 
$table_posts = $table_prefix. "posts"; 
$table_users = $table_prefix. "users"; 
$link =  mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect"); 
 mysql_select_db("$dbname") or die("Could not select database"); 

// Perform Sql Query 
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username 
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u 
WHERE t.topic_id = p.topic_id AND 
f.forum_id = t.forum_id AND 
t.topic_status <> 2 AND 
p.post_id = t.topic_last_post_id AND 
p.poster_id = u.user_id 
ORDER BY p.post_id DESC LIMIT $topicnumber"; 
$result =  mysql_query($query) or die("Query failed"); 

// Outcome of the  HTML 
// Be carefull when you edit these! 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
$topic_title=substr("$row[topic_title]", 0, 24); 
$topic_title = preg_replace("/<(.*?)>/","",$topic_title); 
$topic_title = ereg_replace( "<[^<>]+>", "", $topic_title ); 
$topic_title =  str_replace("\"",""",$topic_title); 
print "<ul>"; 
 echo  "[*]<a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\" title=\"Forum Cellulari\">» $topic_title " . 
".." . 
" </a><img src=\"http://www.cellulartopic.com/images/ico_topics.gif\" alt=\"vai al topic sul cellulare\" />"; 
print "[/list]"; 
} 

// Free Result 
mysql_free_result($result); 

// Close the Connection 
 mysql_close($link);

Grazie mille
EthanDane non in linea   Rispondi citando
Vecchio 23-04-06, 23:09   #2 (permalink)
User
 
L'avatar di EthanDane
 
Data di registrazione: Jun 2005
Messaggi: 429
Invia un messaggio tramite ICQ a EthanDane Invia un messaggio tramite MSN a EthanDane Invia un messaggio tramite Yahoo a EthanDane Invia un messaggio tramite Skype a EthanDane
Modifica a Script per gli ultimi 10 topic

Salve a tutti, per il mio forum di discussione phpBB uso un piccolo script che mi permette di stampare gli ultimi 10 topic.
Mi domandavo come faccio a non far apparire anche i topic privati? ossia quelli che riguardano i forum privati e non al pubblico?

Lo script è il seguente:
codice PHP:


Codice:
// Basic Configuration 
// How Many Topics you want to display? 
$topicnumber = 10; 
// Scrolling towards up or down? 
$scroll = "up"; 
// Change this to your phpBB path 
$urlPath = "http://www/forum"; 

// Database Configuration (Where your phpBB config.php file is located 
include './forum/config.php'; 

// Connecting & Selecting Databases 
$table_topics = $table_prefix. "topics"; 
$table_forums = $table_prefix. "forums"; 
$table_posts = $table_prefix. "posts"; 
$table_users = $table_prefix. "users"; 
$link =  mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect"); 
 mysql_select_db("$dbname") or die("Could not select database"); 

// Perform Sql Query 
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username 
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u 
WHERE t.topic_id = p.topic_id AND 
f.forum_id = t.forum_id AND 
t.topic_status <> 2 AND 
p.post_id = t.topic_last_post_id AND 
p.poster_id = u.user_id 
ORDER BY p.post_id DESC LIMIT $topicnumber"; 
$result =  mysql_query($query) or die("Query failed"); 

// Outcome of the  HTML 
// Be carefull when you edit these! 
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { 
$topic_title=substr("$row[topic_title]", 0, 24); 
$topic_title = preg_replace("/<(.*?)>/","",$topic_title); 
$topic_title = ereg_replace( "<[^<>]+>", "", $topic_title ); 
$topic_title =  str_replace("\"",""",$topic_title); 
print "<ul>"; 
 echo  "[*]<a href=\"$urlPath/viewtopic.php?topic=$row[topic_id]&forum=$row[forum_id]\" title=\"Forum Cellulari\">» $topic_title " . 
".." . 
" </a><img src=\"http://www.cellulartopic.com/images/ico_topics.gif\" alt=\"vai al topic sul cellulare\" />"; 
print "[/list]"; 
} 

// Free Result 
mysql_free_result($result); 

// Close the Connection 
 mysql_close($link);

Grazie mille
EthanDane non in linea   Rispondi citando
Vecchio 24-04-06, 16:07   #3 (permalink)
 
L'avatar di Giorgiotave
 
Data di registrazione: Oct 2004
Ubicazione: Monasterace
Messaggi: 34,891
Invia un messaggio tramite Skype a Giorgiotave
Ciao EthanDane,

nellla query quando estrapoli i topic basta dirgli di non prenderli dall'ID del forum che vuoi.

Se il tuo forum privato ha un id 15 allora aggiundi

AND forum_id!=15

Giorgiotave ora è in linea   Rispondi citando
Vecchio 27-04-06, 15:13   #4 (permalink)
User
 
L'avatar di EthanDane
 
Data di registrazione: Jun 2005
Messaggi: 429
Invia un messaggio tramite ICQ a EthanDane Invia un messaggio tramite MSN a EthanDane Invia un messaggio tramite Yahoo a EthanDane Invia un messaggio tramite Skype a EthanDane
Grazie mille giorgio
EthanDane non in linea   Rispondi citando
Vecchio 10-01-10, 21:11   #5 (permalink)
User Newbie
 
Data di registrazione: Jan 2010
Messaggi: 7
Salve mi associo pure io.
Ho creato in html la home del mio sito e vorrei inserire nella home gli ultimi messaggi 5 o 10 dal forum in phpbb, come posso fare?
Grazie
roberto17 non in linea   Rispondi citando
Vecchio 03-03-10, 21:00   #6 (permalink)
User Newbie
 
Data di registrazione: Jan 2010
Messaggi: 7
risollevo il topic
roberto17 non in linea   Rispondi citando
Rispondi
Tags: , , ,



Strumenti di discussione

Regole di scrittura
Non puoi postare nuove discussioni
Non puoi rispondere alle discussioni
Non puoi allegare file
Non puoi editare i tuoi post

BB code is Attivo
smilies è Attivo
[IMG] il codice è Attivo
Il codice HTML è Disattivato
Trackbacks are Attivo
Pingbacks are Attivo
Refbacks are Disattivato
Vai al forum



Tutti gli orari sono GMT +3. Attualmente sono le 13:00.




Forum GT - © 2004-2009 GT idea S.r.l P.iva 02418200800 - Privacy/Disclaimer

SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.