Homepage  Il progetto dsy.it è l'unofficial support site dei corsi di laurea del Dipartimento di Scienze dell'Informazione e del Dipartimento di Informatica e Comunicazione della Statale di Milano. E' un servizio degli studenti per gli studenti, curato in modo no-profit da un gruppo di essi. I nostri servizi comprendono aree di discussione per ogni Corso di Laurea, un'area download per lo scambio file, una raccolta di link e un motore di ricerca, il supporto agli studenti lavoratori, il forum hosting per Professori e studenti, i blog, e molto altro...
In questa sezione è indicizzato in textonly il contenuto del nostro forum


.dsy:it. .dsy:it. Archive > Community > Tech
 
[RSS] di un forum
Clicca QUI per vedere il messaggio nel forum
publi
Ho un forum in phpbb come posso creare un RSS dei nuovi argomenti che vengono creati dagli utenti?

yeah
Direttamente da PhpBB o come aggiunta?

mrcnet
PHP:
<?php
///////////////////////////////////////////////////////////////////////////////
//                            ACTIVE_TOPICS.PHP
///////////////////////////////////////////////////////////////////////////////
// Copyright:   (C) 2002 Matthijs van de Water <matthijs@beryllium.net>
// Version:     1.1
// Date:        03/02/2002
///////////////////////////////////////////////////////////////////////////////
// Show phpBB 2.0 Active Topics List
// Output format can be any HTML or XML
// This script must be able to access vital phpBB 2.0 configuration scripts
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
// CUSTOM SETTINGS
///////////////////////////////////////////////////////////////////////////////

// Amount of active topics to show
define(&quot;TOPIC_COUNT&quot;, $last);

// Path to the phpBB 2.0 root directory
define(&quot;PHPBB_PATH&quot;, &quot;../forum/&quot;);

// URL to the phpBB 2.0 installation
define(&quot;PHPBB_LOCATION&quot;, &quot;http://www.mrcnetwork.it/cms/forum/&quot;);

// Time format to output the date/time (for format see PHP manual)
define(&quot;TIME_FORMAT&quot;, &quot;U&quot;);

// Title of the phpBB 2.0 installation (used for XML RDF)
// If you don't use this, you forget about this
define(&quot;PHPBB_TITLE&quot;, &quot;mRcNEtwORK.it&quot;);

// Description of the phpBB 2.0 installation (used for XML RDF)
// If you don't use this, you forget about this
define(&quot;PHPBB_DESCRIPTION&quot;, &quot;Ultimi messaggi Forum&quot;);

///////////////////////////////////////////////////////////////////////////////

// Includes of phpBB scripts
$phpbb_root_path PHPBB_PATH;
if ( !
defined('IN_PHPBB') )
{
  
define('IN_PHPBB'true);
  include(
PHPBB_PATH 'extension.inc');
  include(
PHPBB_PATH 'config.'.$phpEx);
  include(
PHPBB_PATH 'includes/constants.'.$phpEx);
  include(
PHPBB_PATH 'includes/db.'.$phpEx);
}

///////////////////////////////////////////////////////////////////////////////
// HTML header start
///////////////////////////////////////////////////////////////////////////////
// make sure this displays as XML
header(&quot;Content-typeapplication/xml&quot;); 
header(&quot;Pragmano-cache&quot;);
echo &
quot;<?xml version=&quot;1.0&quotencoding=&quot;ISO-8859-1&quot;?>\n\n&quot;;
echo &quot;<!DOCTYPE rss PUBLIC &quot;-//Netscape Communications//DTD RSS 0.91//EN&quot;\n&quot;;
echo &quot; &quot;http://my.netscape.com/publish/formats/rss-0.91.dtd&quot;>\n\n&quot;;
echo &quot;<rss version=&quot;0.91&quot;>\n\n&quot;;
echo &quot;<channel>\n&quot;;
echo &quot;<title>mRcNEtwORK.it</title>\n<link><a href="http://www.mrcnetwork.it/cms/index.php" target="_blank">http://www.mrcnetwork.it/cms/index.php</a></link>\n<description>Portale in espansione</description>\n&quot;;
echo &quot;<language>it</language>\n\n&quot;;
?>

<item>
<title><?php echo PHPBB_TITLE?></title>
<link><a href="http://www.mrcnetwork.it" target="_blank">http://www.mrcnetwork.it</a></link>
<description><?php echo PHPBB_DESCRIPTION?></description>
</item>

<?php
///////////////////////////////////////////////////////////////////////////////
// HTML header end
///////////////////////////////////////////////////////////////////////////////

// sql statement to fetch active topics of public forums
$sql = &quot;SELECT DISTINCT t.topic_titlet.topic_last_post_idp.post_timef.forum_name 
  FROM 
&quot; . TOPICS_TABLE . &quot; AS t, &quot; . POSTS_TABLE . &quot; AS p, &quot; . FORUMS_TABLE . &quot; AS 
  WHERE 
    t
.forum_id f.forum_id 
      
AND f.auth_view = &quot; . AUTH_ALL . &quot
      AND 
p.topic_id t.topic_id 
      
AND p.post_id t.topic_last_post_id
  ORDER BY p
.post_time DESC LIMIT &quot; . TOPIC_COUNT;
$nt_result $db->sql_query($sql);

if(!
$nt_result)
{
    die(&
quot;Failed obtaining list of active topics&quot;.mysql_error());
}
else
{
    
$nt_data $db->sql_fetchrowset($af_result);
}
    
if ( 
count($nt_data) == )
{
    die(&
quot;No topics found&quot;);
}
else
{
  
// $nt_data contains all interesting data
  
for ($i 0$i count($nt_data); $i++)
  {
    
$title $nt_data[$i]['topic_title'];
    
$url PHPBB_LOCATION 'viewtopic.' $phpEx . &quot;?&quot; . POST_POST_URL . &quot;=&quot; . $nt_data[$i]['topic_last_post_id'] . &quot;#&quot; . $nt_data[$i]['topic_last_post_id'];
    
    // As of now you can actually do anything with the data
    // I chose to output in XML

///////////////////////////////////////////////////////////////////////////////
// Item HTML start
///////////////////////////////////////////////////////////////////////////////
?>
<item>
<title><?php echo $title?></title>
<link><?php echo $url?></link>
</item>

<?php
///////////////////////////////////////////////////////////////////////////////
// Item HTML end
///////////////////////////////////////////////////////////////////////////////

  
}
}

///////////////////////////////////////////////////////////////////////////////
// Footer HTML start
///////////////////////////////////////////////////////////////////////////////
?>
</channel>
</rss>
<?php
///////////////////////////////////////////////////////////////////////////////
// Footer HTML end
///////////////////////////////////////////////////////////////////////////////

// EOF
?>



in pratica non ho fato altro che modificare lo script dei thread attivi, poi ho aggiunto una variabile last in modo che è l'utente stesso a decidere quanti post visualizzare, per capirci:

http://www.mrcnetwork.it/cms/forum/feedrss.php?last=15

comodissimo da aggiungere in firefox con segnalibro live per tenere tutto sotto controllo..

publi
Mille Grazie :D

publi
mi sto incasinando con i link e i nomi perchè io lo uso all'interno di phpNuke O_o

mrcnet
ma non lo dovevi usare con phpbb? con il nuke puoi farlo sfruttando il backend.php

publi
come faccio col backend.php?

mrcnet
in che senso scusa? il backend sforna già <rss version="0.91">

publi
il backend mi mostra gli rss degli articoli non i messaggi del forum...

mrcnet
appunto ti dicevo che non c'entra nulla.. per quelli del forum ti basta il codice che ho postato prima

publi
io invece ho modificato un po' il backend.php e adesso funziona come RSS del forum.
Grazie per le dritte, mi sono state utilissime!

mrcnet
di nulla ;)

ps. adesso dallo in pasto a google come sitemap e sei a posto

Powered by: vbHome (lite) v4.1 and vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento |Licenze | Thanks | Syndacate