Skrypt:Ostatnio na forum

Poszukuje skryptu dosyć dziwnego.Mam forum w phpbb3 i poszukuję skryptu który na mojej stronie w htmlu tam gdzie bym go umieścił pokazywał by ostatnie wątki na forum lub najciekawsze.

Słabo poszukujesz -> google

fejsik11 ,

Zapoznaj się z tematem i popraw tytuł tematu na konkretny, mówiący o problemie. W celu dokonania zaleconej korekty proszę użyć przycisku Edytuj przy poście otwierającym ten temat.

Zignorowanie zalecenia będzie skutkowało usunięciem tematu do Kosza.

Do wordpressa dodatek poniżej, wiec tylko dostosować wystarczy:

<?php

function lastPhpbbTopic($args = '') {




	$defaults = array(


		'location' => 1,


		'displays' => 3,


		'before' => '',


		'after' => '',


		'table_prefix' => 'phpbb_', // tabela forum


		'char_limit' => 80,


		'dir' => 'http://adres.forum.pl/' // adres www forum


	);




	$r = wp_parse_args( $args, $defaults );


	extract($r, EXTR_SKIP);



	$hidden_forum = "1,2,3,4,5,6,7"; // fora jakie chcesz wykluczyć




	if ( $location ) {


		global $wpdb;


	} else { // konfiguracja bazy danych jezeli inna niz wordpress



		$DB_HOST = 'host'; // host


		$DB_NAME = 'baza'; // nazwa bazy danych


		$DB_USER = 'user'; // user do sql


		$DB_PASS = 'haslo'; // haslo do sql




		$wpdb = new wpdb($DB_USER, $DB_PASS, $DB_NAME, $DB_HOST);


	}



	$sql = "SELECT


		forum.forum_name, post.forum_id, post.post_text,


		topic.topic_id, topic.topic_title, topic.topic_replies,


		topic.topic_last_post_id, user.username


		FROM " . $table_prefix . "posts post


		LEFT JOIN " . $table_prefix . "forums forum ON post.forum_id = forum.forum_id


		LEFT JOIN " . $table_prefix . "users user ON post.poster_id = user.user_id


		LEFT JOIN " . $table_prefix . "topics topic ON post.topic_id = topic.topic_id


		WHERE post.forum_id NOT IN (".$hidden_forum.")


		ORDER BY post.post_time DESC LIMIT $displays


		";




	$result = $wpdb->get_results($sql);




	if ( !$result ) { die('Invalid query: ' . mysql_error()); }




	foreach ($result as $topic) {


		$start = round($topic->topic_replies / 10).'0';


		$topic->post_text = preg_replace("(\[.+?\])is",'',$topic->post_text);


		$topic->post_text = substr($topic->post_text,0,$char_limit)."..."; 





		echo $before.''.$topic->forum_name.' » '.$topic->topic_title.'';

		echo "
autor: ".$topic->username."".$after."\n";


	}


}


?>

[/code]