News dal forum

Php, PHP-Nuke, phpBB, Html, CSS, Javascript e tutto ciò che concerne la gestione siti web.
Avatar utente
Rodney_McKay
Utente veterano
Utente veterano
Messaggi: 309
Iscritto il: 18/06/2005, 20:01
Località: Catania

News dal forum

Messaggio da Rodney_McKay »

Esiste un mod che visualizza in una pagina(per intero) i post inseriti in un topic del forum?
Avatar utente
AleSSaNDRo
WebMaster
WebMaster
Messaggi: 2358
Iscritto il: 24/04/2003, 1:11
Località: Milano

Messaggio da AleSSaNDRo »

Rod, ci stavo lavorando 2 secondi per aiutarti ma devo scappare.
Comunque sia ecco dove sò arrivato:

Codice: Seleziona tutto

<?php

#############
## Edit Below
#############
// L'id del topic da cui deve prendere i suoi post
$topic = '1';

// Come visualizzare la data e l'ora dei post(breve o lunga)
$date_time = 'short';

// How top display the topic link if usede
// topic or phpbb
$topic_link = 'topic';

// Dove mandare l'utente intenzionato a rispondere al topic
$comment = 'topic';

// Path del tuo forum
$phpbb_root_path = './';

#############################################
## No Editing unless you know what your doing
#############################################
if ( !defined('IN_PHPBB') ) 
{
  define('IN_PHPBB', true);
  include($phpbb_root_path  . 'extension.inc');
  include($phpbb_root_path  . 'common.'.$phpEx);
  include($phpbb_root_path  . 'config.'.$phpEx);
}
	

	$grab_topics = $db->sql_query("SELECT * FROM `{$table_prefix}topics` WHERE `topic_id` = '$topic' ORDER BY `topic_id` DESC");
while ($echo_topic = $db->sql_fetchrow($grab_topics))
{
// Grab the information using an array and set it to $echo_topic
	// Select the post information from the correct forum and set it to $grab_posts
	$grab_posts = $db->sql_query("SELECT * FROM `{$table_prefix}posts` WHERE `topic_id` = '$topic'");
	
	// Grab the information using an array and set it to $echo_post
	while ($echo_post = $db->sql_fetchrow($grab_posts))
	{
		// Now get the post_text using the post_id were looking at and sort it info $grab_posts_text
		$grab_posts_text = $db->sql_query("SELECT * FROM `{$table_prefix}posts_text` WHERE `post_id` = ''");
		
		// Grab the information using an array and set it to $echo_text
		while($echo_text = $db->sql_fetchrow($grab_posts_text))
		{
			// Find the user the posted
			$find_user = $db->sql_query("SELECT * FROM `{$table_prefix}users` WHERE `user_id` = '{$echo_post['poster_id']}'");
			
			// Sort this users info into array for the post
			while ($echo_user = $db->sql_fetchrow($find_user))
			{
					
				// Get rid of all those annoying characters from bbcode
				$echo_text = preg_replace('/\:[0-9a-z\:]+\]/si', ']', $echo_text);	
				
				// BBCode
				$echo_text = str_replace("[b]","<strong>",$echo_text);
				$echo_text = str_replace("[/b]","</strong>",$echo_text);
					
				$echo_text = str_replace("[i]","<em>",$echo_text);
				$echo_text = str_replace("[/i]","</em>",$echo_text);
					
				$echo_text = str_replace("[u]","<u>",$echo_text);
				$echo_text = str_replace("[/u]","</u>",$echo_text);
					
				$echo_text = preg_replace('/\[quote=(.*)\](.*)\[\/quote\]/Usi','<div style=\"padding: 7px\">$2</div>',$echo_text);
				
				$echo_text = str_replace("[quote]","<strong>Quote</strong><em>",$echo_text);
				$echo_text = str_replace("[/quote]","</em>",$echo_text);
					
				$echo_text = str_replace("[code]","<strong>Code</strong><em>",$echo_text);
				$echo_text = str_replace("
","</em>",$echo_text);

$echo_text = preg_replace('/\[list\](.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);
$echo_text = preg_replace('/\
  • (.*)\[\/list\]/si',"<div style=\"padding: 7px\">$1</div>",$echo_text);

    $echo_text = str_replace("[img]","<img src=\"",$echo_text);
    $echo_text = str_replace("[/img]","\" alt=\"image\" />",$echo_text);

    $echo_text = preg_replace('/\[url\](.*)\[\/url\]/Usi','<a href="$1">$1</a>',$echo_text);
    $echo_text = preg_replace('/\[url=(.*)\](.*)\[\/url\]/Usi','<a href="$1">$2</a>',$echo_text);

    $echo_text = str_replace("\n", "\n<br />\n", $echo_text);

    // Way to display date and time
    // long
    if($date_time == "long")
    {
    $echo_topic['topic_time'] = strftime("%A %e %B %H:%M",$echo_topic['topic_time']);
    }

    // short
    if ($date_time == "short")
    {
    $echo_topic['topic_time'] = strftime("%a %e %b %H:%M",$echo_topic['topic_time']);
    }

    // Way to display comment link
    // Go right to the topic
    if ($comment == 'topic')
    {
    $comment_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
    }

    // Go right to the reply box
    if ($comment == 'reply')
    {
    $comment_link = "{$phpbb_root_path}posting.php?mode=reply&t={$echo_topic['topic_id']}";
    }

    // Topic link types
    // This link goes to the topic display
    if ($topic_link == 'topic')
    {
    $topic_link = "?show1=topic&t={$echo_topic['topic_id']}";
    }

    // This link goes to the actual phpbb topic
    if ($topic_link == 'phpbb')
    {
    $topic_link = "{$phpbb_root_path}viewtopic.php?t={$echo_topic['topic_id']}";
    }

    ##################################
    ## Edit for look and feel of topic
    ##################################
    // Display just the title

    if ($show != 'full' && !isset($_GET['show1']))
    {
    echo "<a href='{$topic_link}'>{$echo_text['post_subject']}</a><br />";
    }

    // Display many topics - for news, shoutbox etc
    echo "
    <strong>{$echo_text['post_subject']}</strong> by <strong>{$echo_user['username']}</strong> at <strong>{$echo_topic['topic_time']}</strong>
    <br />
    <br />
    {$echo_text['post_text']}
    <br />
    <br />
    <a href=\"{$comment_link}\">Commenti {$echo_topic['topic_replies']}</a>
    <hr size=\"1\">
    ";
    }
    }
    }
    }
    ?>[/code]
Avatar utente
Rodney_McKay
Utente veterano
Utente veterano
Messaggi: 309
Iscritto il: 18/06/2005, 20:01
Località: Catania

Messaggio da Rodney_McKay »

Warning: main(forumextension.inc): failed to open stream: No such file or directory in /web/htdocs/www.webatlantis.net/home/news.php on line 28

Warning: main(): Failed opening 'forumextension.inc' for inclusion (include_path='.:/php/lib/php/') in /web/htdocs/www.webatlantis.net/home/news.php on line 28

Warning: main(forumcommon.): failed to open stream: No such file or directory in /web/htdocs/www.webatlantis.net/home/news.php on line 29

Warning: main(): Failed opening 'forumcommon.' for inclusion (include_path='.:/php/lib/php/') in /web/htdocs/www.webatlantis.net/home/news.php on line 29

Warning: main(forumconfig.): failed to open stream: No such file or directory in /web/htdocs/www.webatlantis.net/home/news.php on line 30

Warning: main(): Failed opening 'forumconfig.' for inclusion (include_path='.:/php/lib/php/') in /web/htdocs/www.webatlantis.net/home/news.php on line 30

Fatal error: Call to a member function on a non-object in /web/htdocs/www.webatlantis.net/home/news.php on line 34

:(
Avatar utente
AleSSaNDRo
WebMaster
WebMaster
Messaggi: 2358
Iscritto il: 24/04/2003, 1:11
Località: Milano

Messaggio da AleSSaNDRo »

L'ho provato al volo e non dà errori ma comunque non funziona...dà ancora pagina bianca.
Guarda che devo modificare // Path del tuo forum
$phpbb_root_path = './';
Il tuo errore mi fa pensare che hai impostato quel parametro così:
// Path del tuo forum
$phpbb_root_path = './forum';
invece che così:
// Path del tuo forum
$phpbb_root_path = './forum/';
Avatar utente
Rodney_McKay
Utente veterano
Utente veterano
Messaggi: 309
Iscritto il: 18/06/2005, 20:01
Località: Catania

Messaggio da Rodney_McKay »

Già, adesso anche a me da pagina bianca :(

Chi c’è in linea

Visitano il forum: Claude [Bot] e 0 ospiti