Fonction PHP : tag()

Ici, vous pouvez voir (et copier/coller) le code complet de la fonction PHP tag(). N'hésitez pas voter pour cette fonction si elle vous plaît ou si vous vouv en servez !

tag() ajouté le 2009-06-10 10:19:38 par yosweb

function tags($max_tags){
        $chaine_tags=array();
	$tab_tags=array();
	$result=mysql_query("SELECT * FROM articles");
	while ($tags=mysql_fetch_object($result)){
		$chaine_tags[]=explode(",",$tags->tag);
	}
	//Remplir le tableau $tab_tags par les tags des enregistrements
	for ($i=0;$i<=count($chaine_tags)-1;$i++){
		for ($j=0;$j<=count($chaine_tags[$i])-1;$j++){				
			if (!empty($chaine_tags[$i][$j])) $tab_tags[]=$chaine_tags[$i][$j];	
		}
	}
	$mots=array_unique($tab_tags);  // Supprimer les doublons
	shuffle($mots);  // Mélanger les tags
	// Tableau des couleur aléatoires de votre choix
	$tab_colors=array("#3087F8","#EC1E85","#14E414","#9EA0AB");
	// Affichage des tags
	for ($i=0;$i<=$max_tags-1;$i++){
	       $fontsize = rand(10,22).'px'; //fontsize aléatoire ici entre 10 et 22 px
	       $color=rand(0,count($tab_colors)-1); //La couleur aléatoir
		$nuage_tags .='<a style="font-size:'.$fontsize.'; color:'.$tab_colors[$color].'; " href="recherche.php?tag='.urlencode($mots[$i]).'" title="Rechercher le tag '.$mots[$i].'">'.$mots[$i].'</a> ';
	}
	echo "<div class='tags'>".$nuage_tags."</div>";
}

Voter pour cette fonction


Une fonction pour afficher un nuage de tag en php / mysql, les mot clés sont enregistrés dans une table (exp "Articles") sur un champ tag, pour utiliser cette fonction il suffi juste d'adapter les champs de votre base de données et définir le nombre maximum des tags qui seront afficher et le choix des couleurs aléatoire.

Pour plus d'info visitez le http://www.douami.com
Merci au fondateur de ce site.

Commentaires sur la fonctions php

coach outlet online 30/12/2016 à 02:57

The program, which hit 75 young people in the choir True Religion Jeans and Ray Ban Website Alicia Keys Oakley Outlet in New York City Michael Kors Outlet last year Red Bottom Shoes defeated the mind of Air Max Shoes Sale the empire Moncler Jackets thinking (coincidentally UGG Outlet, UGG Boots claiming PR). Also, Instagram throws a return in Ray-Ban person. Ray Ban Outlet Due to North Face the collection North Face Outlet itself, the photogenic Air Jordan Shoes party space Ray Ban Sunglasses in the 1970s Christian Louboutin Gasugattsura, roadside Oakley Outlet neon lights Ray-Ban Sunglasses, such as Michael Kors Online Store the strange Christian Louboutin Outlet thing, the lovely Ugg Boots American motel UGG Boots, Ugg Outlet was a bit Christian Louboutin Outlet unhappy. Hey, Michael Kors Outlet this is not the melting pot. This is a mosaic.


Motorcycle jacket, banshee coat, nostalgic cut ring, a M-65 Parker version of a girl, it comes with Louis Vuitton Factory Outlet almost all of the embroidered patch. The slogan John Lindsay Mayor of Coach Outlet Online New York and the New York City Alliance of 1968 (New York City League) were considered "particularly anxious", which showed " Christian Louboutin Shoes Please be careful." With the death of today's astronaut John Glenn, In the Sweater's NASA logo, the shuttle's interior Siaes Ray Ban Sunglasses was detailed in the Apollo sweater's first Coach outing for Fall 2014. By collaborating with artist Gary Basel, morning tea. This phenomenon, rather than marks and ice cream stinkers embroidered, leather jackets Moncler Jackets and T-shirts Burberry Outlet staged. Everyone wants to announce their identity recently. Vevers offers various options to his clients, but he opposes it. You do not have to rarely see the logo of the coach. At least I did not find it.


As for the United Kingdom, Vevers of the United States of deep happiness and love. It explains how to repackage. His collection, and indeed interesting bags and shoes Coach Outlet, and even the project-Y leather-driven coat Burberry Outlet, sensible statement knit, toss-ON-ON-dress. But every time, he has found a new way. The season is the grassland wearing a cowboy boots Red Bottom Heels a girl. Here is a bike girl who likes Elvis. Before the fall, both Kate Spade Outlet men and women, as it is installed in the runway on the set, is the most Nike Air Max Plus UK eclectic mashup so far. "To summarize the set, we have considered optimism and coexistence," Vevers said and said. "It gives the clothes, sets, inspires casting. It's a breed that reflects the real life."


Three years ago, before Stuart Burberry Outlet Official Beaver arrived Ray Ban Outlet at the Coach Outlet Store Online, in order to Coach Outlet see the label's True Religion pre-fall show Louis Vuitton Outlet, who thought of Moncler Jackets gathering True Religion Outlet the wharf for Michael Kors Purses 94 winter Ugg Outlet Official desolate nights North Face Jackets? In a very short time Burberry Handbags, Vevers is UGGS Outlet that Ugg Classis Boots this North Face Coats has been North Face Jackets the traditional Michael Kors brand of Coach Outlet American work Moncler Outlet magic: the design of Moncler Outlet a coat coat North Face Outlet and jacket North Face Jackets Outlet, has produced any Ray-Ban Outlet type of copy Oakley Sunglasses, please imagine Ray Ban Outlet a T rex Ray Ban Outlet dragon mascot North Face Outlet REXY .. hanging from Ray Ban Official the handbag Burberry Scarf The editors Ugg Boots Online have an appeal UGG Outlet Store. Last month, Christian Louboutin Shoes the new 20,000-square-footCoach Factory Outlet flagship opened Oakley Sunglasses its doors on Fifth Avenue. Not a bad way to spend 75 years in the company, but tonight is a real celebration.