Wikini

MattRixxRecentCommentRSS

PagePrincipale :: DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur :: Vous êtes ec2-18-190-156-80.us-east-2.compute.amazonaws.com

Création de l'action Pour obtenir le fil RSS des derniers commentaires, utilisez l'adresse suivante: http://wikini.net/wakka.php?wiki=MattRixxRecentCommentRSS/xml


Après avoir découvert que WikiNi gérer les fil rss (http://www.wikini.net/wakka.php?wiki=DerniersChangementsRSS/xml) je me suis empressé de mettre ca sur mon site car je m'en sers beaucoup... malheureusement je ne surveillais que les derniers changements, pas les derniers commentaires... J'ai donc du me faire mes propre actions {{recentcommentsrss}} et {{recentlycommentedsrss}}

dans /actions/recentcommentsrss.php:
<?php

if ($comments = $this->LoadRecentComments())
{
	if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"];
	$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
	$output .= "<!-- RSS v0.91 generated by Wikini -->\n";
	$output .= "<rdf:RDF\n";
	$output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
	$output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
 
	$output .= "<channel>\n";
	$output .= "<title> Derniers commentaires sur ". $this->config["wakka_name"]  . "</title>\n";
	$output .= "<link>" . $this->config["base_url"] . $link . "</link>\n";
	$output .= "<description> Derniers commentaires sur " . $this->config["wakka_name"] . " </description>\n";
	$output .= "<language>fr</language>\n";
	$output .= "</channel>\n";
	
	foreach ($comments as $comment)
	{
		list($day, $time) = explode(" ", $comment["time"]);
		$day= preg_replace("/-/", " ", $day);
		list($hh,$mm,$ss) = explode(":", $time);
		$output .= "<item>\n";
		$output .= "<title> Commentaire de " . $comment["comment_on"] . " --- par " .$comment["user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n";
		$output .= "<description> Commentaire de " . $comment["comment_on"] . " --- par " .$comment["user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n";
		$output .= "<link>" . $this->config["base_url"] . $comment["comment_on"] . "&amp;show_comments=1#" . $comment["tag"] . "</link>\n";
		$output .= "</item>\n";

	}
	
	$output .= "</rdf:RDF>\n";
	echo $output ;
}

?>


dans /actions/recentlycommentedrss.php:
<?php
$max = 50;

// Show recently commented pages
if ($pages = $this->LoadRecentlyCommented($max))
{
	if (!($link = $this->GetParameter("link"))) $link=$this->config["root_page"];
	$output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n";
	$output .= "<!-- RSS v0.91 generated by Wikini -->\n";
	$output .= "<rdf:RDF\n";
	$output .= "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
	$output .= "xmlns=\"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n";
 
	$output .= "<channel>\n";
	$output .= "<title> Derniers commentaires sur ". $this->config["wakka_name"]  . "</title>\n";
	$output .= "<link>" . $this->config["base_url"] . $link . "</link>\n";
	$output .= "<description> Derniers commentaires sur " . $this->config["wakka_name"] . " </description>\n";
	$output .= "<language>fr</language>\n";
	$output .= "</channel>\n";
	
	foreach ($pages as $page)
	{
		// day header
		list($day, $time) = explode(" ", $page["comment_time"]);
		$day= preg_replace("/-/", " ", $day);
		list($hh,$mm,$ss) = explode(":", $time);
		$output .= "<item>\n";
		$output .= "<title>" . $page["tag"] . " --- par " .$page["comment_user"] . " le " . $day ." - ". $hh .":". $mm . "</title>\n";
		$output .= "<description> Commentaire de " . $page["tag"] . " --- par " .$page["comment_user"] . " le " . $day ." - ". $hh .":". $mm . "</description>\n";
		$output .= "<link>" . $this->config["base_url"] . $page["tag"] . "&amp;show_comments=1#" . $page["comment_tag"] . "</link>\n";
		$output .= "</item>\n";
	}
	$output .= "</rdf:RDF>\n";
	echo $output ;
}
?>


Pour l'utilisation du fil rss dans WikiNi, Editer la page DerniersChangementsRSS et pour un exemple http://www.mattlab.com/artwork/FilRSSComment.
Il n'y a pas de commentaire sur cette page. [Afficher commentaires/formulaire]