Comment créer un nuage de tags php/mysql

123 posts in this topic

Posted · Report post

C'est possible que tu me post ici un petit dump avec par exemple une quarantaine de recherche?

Voila :)

-- phpMyAdmin SQL Dump
-- version 2.6.2-Debian-3sarge3
-- [url="http://www.phpmyadmin.net"]http://www.phpmyadmin.net[/url]
--
-- Serveur: localhost
-- Généré le : Mercredi 06 Juin 2007 à 17:17
-- Version du serveur: 4.1.15
-- Version de PHP: 4.3.10-19
--
-- Base de données: `sitefr`
--

-- --------------------------------------------------------

--
-- Structure de la table `tag_cloud`
--

CREATE TABLE `tag_cloud` (
`id` int(11) NOT NULL auto_increment,
`tag_name` varchar(100) NOT NULL default '',
`nbsearch` int(11) NOT NULL default '0',
`aff_front` int(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=159 ;

--
-- Contenu de la table `tag_cloud`
--

INSERT INTO `tag_cloud` VALUES (1, 'maya', 19, 1);
INSERT INTO `tag_cloud` VALUES (2, '3ds', 10, 1);
INSERT INTO `tag_cloud` VALUES (3, 'photoshop', 17, 1);
INSERT INTO `tag_cloud` VALUES (6, '3dsmax', 17, 1);
INSERT INTO `tag_cloud` VALUES (24, 'cinema4d', 15, 1);
INSERT INTO `tag_cloud` VALUES (8, 'cinema 4d', 11, 1);
INSERT INTO `tag_cloud` VALUES (9, 'dosch', 15, 1);
INSERT INTO `tag_cloud` VALUES (10, 'dosch 3d', 11, 0);
INSERT INTO `tag_cloud` VALUES (12, 'intuos', 24, 1);
INSERT INTO `tag_cloud` VALUES (13, 'Brazil r/s', 12, 1);
INSERT INTO `tag_cloud` VALUES (65, 'livre', 6, 1);
INSERT INTO `tag_cloud` VALUES (17, 'zbrush', 16, 1);
INSERT INTO `tag_cloud` VALUES (18, 'intuos', 21, 0);
INSERT INTO `tag_cloud` VALUES (89, 'Brazilirs', 10, 0);
INSERT INTO `tag_cloud` VALUES (20, 'Syflex', 17, 1);
INSERT INTO `tag_cloud` VALUES (21, 'Exposé', 17, 1);
INSERT INTO `tag_cloud` VALUES (22, 'vegas', 15, 0);
INSERT INTO `tag_cloud` VALUES (80, 'bryceia', 5, 0);
INSERT INTO `tag_cloud` VALUES (27, 'gnomon', 21, 1);
INSERT INTO `tag_cloud` VALUES (28, 'personnages', 15, 1);
INSERT INTO `tag_cloud` VALUES (29, 'Les Ateliers 3dsmax - Vol.1', 12, 1);
INSERT INTO `tag_cloud` VALUES (135, 'tabletteigraphique', 2, 0);
INSERT INTO `tag_cloud` VALUES (134, 'sdsimaxiO', 1, 0);
INSERT INTO `tag_cloud` VALUES (133, 'mangaisd', 1, 0);
INSERT INTO `tag_cloud` VALUES (132, 'syflex0sOappart', 2, 0);
INSERT INTO `tag_cloud` VALUES (34, 'DX Studio', 4, 1);
INSERT INTO `tag_cloud` VALUES (131, 'MUDBOX', 2, 0);
INSERT INTO `tag_cloud` VALUES (122, 'Exposec', 2, 0);
INSERT INTO `tag_cloud` VALUES (123, 'sDiStudioiMax', 4, 0);
INSERT INTO `tag_cloud` VALUES (124, 'sds', 3, 0);
INSERT INTO `tag_cloud` VALUES (125, 'sDiMax', 2, 0);
INSERT INTO `tag_cloud` VALUES (126, 'doschsd', 3, 0);
INSERT INTO `tag_cloud` VALUES (127, 'sDiMaxistudio', 2, 0);
INSERT INTO `tag_cloud` VALUES (128, 'sDSMaxistudio', 2, 0);
INSERT INTO `tag_cloud` VALUES (129, 'Exposcccccccc', 3, 0);
INSERT INTO `tag_cloud` VALUES (130, 'LesiAteliersisdsmaxiiVolC', 9, 0);
INSERT INTO `tag_cloud` VALUES (121, 'adobeiproduction', 4, 0);
INSERT INTO `tag_cloud` VALUES (120, 'adobe', 3, 1);
INSERT INTO `tag_cloud` VALUES (119, 'sexibombe', 2, 0);
INSERT INTO `tag_cloud` VALUES (118, 'petiteU0bite', 2, 0);
INSERT INTO `tag_cloud` VALUES (117, 'freeform', 2, 0);
INSERT INTO `tag_cloud` VALUES (116, 'Exposeeec', 1, 0);
INSERT INTO `tag_cloud` VALUES (115, 'Exposeeeec', 1, 0);
INSERT INTO `tag_cloud` VALUES (91, 'Expos', 9, 0);
INSERT INTO `tag_cloud` VALUES (90, 'DXiStudio', 10, 0);
INSERT INTO `tag_cloud` VALUES (78, 'dosch3d', 3, 0);
INSERT INTO `tag_cloud` VALUES (87, 'sdsmax', 14, 0);
INSERT INTO `tag_cloud` VALUES (88, 'cinemai4d', 8, 0);
INSERT INTO `tag_cloud` VALUES (75, 'xsi', 8, 0);
INSERT INTO `tag_cloud` VALUES (114, 'Exposeec', 1, 0);
INSERT INTO `tag_cloud` VALUES (113, 'doschisd', 4, 0);
INSERT INTO `tag_cloud` VALUES (72, 'DXStudio', 5, 0);
INSERT INTO `tag_cloud` VALUES (109, 'ddrisdram', 1, 0);
INSERT INTO `tag_cloud` VALUES (108, 'LesAtelierssdsmaxVolC', 4, 0);
INSERT INTO `tag_cloud` VALUES (70, 'modo', 10, 0);
INSERT INTO `tag_cloud` VALUES (110, 'bionatics', 3, 0);
INSERT INTO `tag_cloud` VALUES (111, 'bite', 1, 0);
INSERT INTO `tag_cloud` VALUES (112, 'petitebite', 1, 0);
INSERT INTO `tag_cloud` VALUES (81, 'bryce', 6, 0);
INSERT INTO `tag_cloud` VALUES (136, 'vray', 1, 0);
INSERT INTO `tag_cloud` VALUES (137, 'unfold', 4, 0);
INSERT INTO `tag_cloud` VALUES (138, 'Exposcccccccccc', 1, 0);
INSERT INTO `tag_cloud` VALUES (139, 'Toolbar', 1, 0);
INSERT INTO `tag_cloud` VALUES (140, 'Exposeiec', 1, 0);
INSERT INTO `tag_cloud` VALUES (141, 'driver', 1, 0);
INSERT INTO `tag_cloud` VALUES (142, 'Willy', 1, 0);
INSERT INTO `tag_cloud` VALUES (143, 'manga', 1, 0);
INSERT INTO `tag_cloud` VALUES (144, 'textures', 1, 0);
INSERT INTO `tag_cloud` VALUES (145, 'petiteibite', 1, 0);
INSERT INTO `tag_cloud` VALUES (146, 'UquotaaliasisketchbookiproUUquota', 2, 0);
INSERT INTO `tag_cloud` VALUES (147, 'aliasisketchbookipro', 1, 0);
INSERT INTO `tag_cloud` VALUES (148, 'Brazilrs', 1, 0);
INSERT INTO `tag_cloud` VALUES (149, 'Tollbarre', 1, 0);
INSERT INTO `tag_cloud` VALUES (150, 'dvd', 1, 0);
INSERT INTO `tag_cloud` VALUES (151, 'gnomonichracter', 1, 0);
INSERT INTO `tag_cloud` VALUES (152, 'gnomoniproduction', 2, 0);
INSERT INTO `tag_cloud` VALUES (153, '', 3, 0);
INSERT INTO `tag_cloud` VALUES (155, 'ic211', 1, 0);
INSERT INTO `tag_cloud` VALUES (154, 'lightroom', 1, 0);
INSERT INTO `tag_cloud` VALUES (156, 'ic 211', 1, 0);
INSERT INTO `tag_cloud` VALUES (157, 'bamboo', 1, 0);
INSERT INTO `tag_cloud` VALUES (158, 'wacom', 1, 0);[/codebox]

Share this post


: post
Share on other sites

Posted · Report post

le dvp est terminé ... tu veux le fichier ?

Share this post


: post
Share on other sites

Posted · Report post

fichier Tags.php ; à placer dans le repertoire administrer de votre site


<?

include("../configuration.inc.php");
necessite_identification();
necessite_priv("admin");

$DOC_TITLE = "G&eacute;rer les Tags de recherche";

include("modeles/haut.php");

switch (vb($_REQUEST['mode'])) {



case "maj_statut" :

for ($i = 0;$i< count($_POST['id']);$i++) {

if (vb($_POST['change_statut'.$_POST['id'][$i].'']) == "on") {

$sql = "update tag_cloud SET afficheFront = '".intval($_POST['statut'])."' WHERE id = '".intval($_POST['id'][$i])."'";

mysql_query($sql) or die('Une erreur de connexion à la base s est produite ' . __LINE__ . '.<p>' . MYSQL_ERROR());

}

}

echo "Le statut des Tags coch&eacute;s a &eacute;t&eacute; mis &agrave; jour.";

$order = "id";

$sort = "DESC";

affiche_liste_tags(vn($_POST['start']), $order, $sort);

break;


case "suppr" :
efface_tag($_GET['id']);
$order = "id";
$sort = "DESC";
affiche_liste_tags(vn($_REQUEST['start']), $order, $sort);
break;




case "tri" :
affiche_liste_tags(vn($_REQUEST['start']), $_GET['order'], $_GET['sort']);
break;

default :
$order = "id";
$sort = "DESC";
affiche_liste_tags(vn($_REQUEST['start']), $order, $sort);
break;
}

include("modeles/bas.php");

/******************************************************************************
* FONCTIONS
*****************************************************************************/

function efface_tag($id) {
/* Efface le tag dont le n° est $id */

global $wwwroot;

mysql_query("DELETE FROM tag_cloud WHERE id = '$id'");

}

function update_commande($frm) {
/* Efface la commande dont le n° est $id */

global $wwwroot;

$statut_details = "";

if ($frm['statut'] != 0) {

$sql_statut = "SELECT nom_".$_SESSION['langue']." FROM peel_statut WHERE id = '".$frm['statut']."'";

$res_statut = mysql_query($sql_statut);

$s = mysql_fetch_array($res_statut);

$statut_details = $s['nom_'.$_SESSION['langue'].''];

} else {

$statut_details = "commande initialis&eacute;e";

}



}



function affiche_liste_tags($start, $order, $sort) {

global $wwwroot;

$nb = 30;

# Charge la liste des commandes et les affiche.
$qid = mysql_query("SELECT * FROM tag_cloud ORDER BY $order $sort LIMIT $start,$nb
");

$sql_count = "SELECT COUNT(*) FROM tag_cloud ORDER BY $order $sort";

include("modeles/Tags_liste.php");
}

?>
[/codebox]

Share this post


: post
Share on other sites

Posted · Report post

fichier Tags_liste.php ; à placer dans le repertoire administrer/modeles de votre site


<table border="0" cellpadding="0" cellspacing="0" width="100%">

<tr>
<td class="entete" colspan="10">Liste des Tags</td>
</tr>

<?
if ($qid) {

if (mysql_num_rows($qid) == 0)
{
"<tr><td colspan=\"10\" class=\"normal\"><b>Aucune recherche enregistr&eacute;e dans la base.</b></td></tr>"; }
else {
?>
<tr>
<td class="menu">Action</td>
<td class="menu" align="center">
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=id&sort=desc"><img src="<?=$wwwroot?>/administrer/images/desc.gif" width="7" height="7" alt="" border="0"></a>
ID
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=id&sort=asc"><img src="<?=$wwwroot?>/administrer/images/up.gif" width="7" height="7" alt="" border="0"></a>
</td>


<td class="menu" align="center">
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=tag_name&sort=desc">
<img src="<?=$wwwroot?>/administrer/images/desc.gif" width="7" height="7" alt="" border="0"></a>
Recherche
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=tag_name&sort=asc">
<img src="<?=$wwwroot?>/administrer/images/up.gif" width="7" height="7" alt="" border="0"></a></td>

<td class="menu" align="center">
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=nbsearch&sort=desc">
<img src="<?=$wwwroot?>/administrer/images/desc.gif" width="7" height="7" alt="" border="0"></a>
Nbre de fois
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=nbsearch&sort=asc">
<img src="<?=$wwwroot?>/administrer/images/up.gif" width="7" height="7" alt="" border="0"></a></td>

<td class="menu" align="center">
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=afficheFront&sort=desc">
<img src="<?=$wwwroot?>/administrer/images/desc.gif" width="7" height="7" alt="" border="0"></a>
Validation
<a href="<?=$_SERVER['PHP_SELF']?>?mode=tri&order=afficheFront&sort=asc">
<img src="<?=$wwwroot?>/administrer/images/up.gif" width="7" height="7" alt="" border="0"></a></td>


</tr>
<form method="post" name="form_statut_lot" action="<?php echo $_SERVER['PHP_SELF']?>">
<input type="hidden" name="mode" value="maj_statut">
<input type="hidden" name="start" value="<?php echo vn($_GET['start'])?>">

<?
$i = 0;
while ($r = mysql_fetch_object($qid)) { ?>
<tr bgcolor="<?echo ($i % 2 == 0 ? '#F4F4F4' : '#ffffff' );?>">
<td class="normal" align="center">
<a onClick="java script:return confirm('&ecirc;tes-vous s&ucirc;r de vouloir supprimer ce tag ?\nAttention : d&eacute;finitif !;');" class=normal href="<?=$_SERVER['PHP_SELF']?>?mode=suppr&id=<?=$r->id ?>"><img src="images/b_drop.png" alt="supprimer" border="0"></a></td>
<td class="normal" align="center"><?=$r->id?></td>
<td class="normal" align="center"><?=$r->tag_name?></td>
<td class="normal" align="center"><?php echo $r->nbsearch;?></td>

<td class="normal" align="center">
<input type="hidden" name="id[]" value="<?php echo $r->id;?>">
<table width="100%" border="0"><tr><td class="normal" align="center">
<td class="normal" align="center"><?php echo $r->afficheFront;?></td>

</td><td class="normal" width="10">
<input type="checkbox" name="change_statut<?php echo $r->id;?>">
</td></tr></table>

</td>
</tr>
<?
$i++;} // Fin de la boucle While

echo "<tr><td colspan=\"10\" class=\"normal\" align=\"center\">";

?>
<select name="statut" class="formulaire1">
<option value="0">non visible</option>
<option value="1">visible</option>
</select>

<?php
echo "<input type=\"submit\" value=\"modifier le statut des Tags coch&eacute;s\" class=\"bouton\"></p>";

echo "</form>";

echo "</td></tr>";


echo "<tr><td colspan=\"10\" class=\"normal\" align=\"center\">";

// Boutons pr&eacute;c&eacute;dent et suivant
if($start) {

echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&id=".vb($_GET['id'])."&statut=".vb($_GET['statut'])."&start=".($start-$nb)."\">page pr&eacute;c&eacute;dente</a>");

}

$result = mysql_query($sql_count);

$row = mysql_fetch_row($result);

if($row[0]>($start+$nb))
{

if($start) {echo(" / ");}

echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&id=".vb($_GET['id'])."&statut=".vb($_GET['statut'])."&start=".($start+$nb)."\">page suivante</a>");

}

echo("<br />");


// Affichage des pages
if($row[0]>$nb) {// le nombre d'enreg. est > au nb de lignes d'affichage ?

for($index=0;($index*$nb)<$row[0];$index++) // oui alors on affiche les num&eacute;ros de pages
{
?>
<a class="normal" href="<?echo $_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&id=".vb($_GET['id'])."&statut=".vb($_GET['statut'])."&order=".$order."&sort=".$sort."&start=".$index*$nb; ?>"><?echo $index+1; ?></a>&nbsp;
<?
}

}

echo "</td></tr>";

}

}?>

</table>
[/codebox]

Share this post


: post
Share on other sites

Posted · Report post

le seul problème restant etant les boutons precedent et suivant que j'ai pas réussi à gerer , question de patience que je n'ai pas...

MAIS -->

les clik sur num de pages,

les tris ,

la modif en direct sur les listes, par groupe,

TOUT CA MARCHE!

Share this post


: post
Share on other sites

Posted · Report post

je teste, quelle vitesse :)

EDIT : Une erreur de connexion à la base s est produite 24.

Unknown column 'afficheFront' in 'field list'

Quand je veux updater le status

Share this post


: post
Share on other sites

Posted · Report post

Reste à mettre de dvp poru la page de recherche et si l'article cherché est trouév ou non.

Willy

Share this post


: post
Share on other sites

Posted · Report post

je crois que 3DVF l'a déjà mis en place :)

Share this post


: post
Share on other sites

Posted · Report post

je crois que 3DVF l'a déjà mis en place :)

Oui, mais pour nous, pour l'installer sur nos sites :) :lol:

Share this post


: post
Share on other sites

Posted · Report post

Reste à mettre de dvp poru la page de recherche et si l'article cherché est trouév ou non.

Willy

Oui c'est fait ça, Update de mon message au dessus, y a une erreur.

Share this post


: post
Share on other sites

Posted · Report post

ok, vas dans MYSQL

modifier structure table tag_cloud

change juste le nom du champ aff_front en afficheFront

Share this post


: post
Share on other sites

Posted · Report post

Willy peux tu améliorer la partie page suivante, precedente qui se trouve dans tags_liste.php une fois qu'il livre la totalité des fichiers?

Share this post


: post
Share on other sites

Posted · Report post

Oui je peux voir.

Willy

Share this post


: post
Share on other sites

Posted · Report post

alors 3DVF ? ca marche comme tu veux?

Share this post


: post
Share on other sites

Posted · Report post

Willy peux tu améliorer la partie page suivante, precedente qui se trouve dans tags_liste.php une fois qu'il livre la totalité des fichiers?

Je dirais de remplacer:

// Boutons pr&eacute;c&eacute;dent et suivant 

if($start) {


echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&id=".vb($_GET['id'])."&statut=".vb($_GET['statut'])."&start=".($start-$nb)."\">page pr&eacute;c&eacute;dente</a>");


} 


$result = mysql_query($sql_count); 


$row = mysql_fetch_row($result); 


if($row[0]>($start+$nb)) 

{ 


if($start) {echo(" / ");} 


echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&id=".vb($_GET['id'])."&statut=".vb($_GET['statut'])."&start=".($start+$nb)."\">page suivante</a>"); 


} 


echo("<br />");
Par:
// Boutons pr&eacute;c&eacute;dent et suivant 

$nb=30;

if($start) {


echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&sort=".vb($_GET['sort'])."&start=".(vn($_GET['start']) - $nb)."&order=".vb($_GET['order'])."\">page pr&eacute;c&eacute;dente</a>");


} 


$result = mysql_query($sql_count); 


$row = mysql_fetch_row($result); 


if($row[0]>($start+$nb)) 

{ 


if($start) {echo(" / ");} 


echo("<a class=normal href=\"".$_SERVER['PHP_SELF']."?mode=".vb($_GET['mode'])."&sort=".vb($_GET['sort'])."&start=".(vn($_GET['start']) + $nb)."&order=".vb($_GET['order'])."\">page suivante</a>"); 


} 


echo("<br />");

Mais c'est vite fait et sans pouvoir tester :)

Willy

Share this post


: post
Share on other sites

Posted · Report post

alors 3DVF ? ca marche comme tu veux?

Ayé tous marche nickel, il ne me reste plus qu'a faire un package que je vais vous revendre :)

Donc ça tourne toutes la nuit et demain Go validation avec trasfert du script ici .

Share this post


: post
Share on other sites

Posted · Report post

il ne me reste plus qu'a faire un package que je vais vous revendre

et nos royalties ? ah oui, on t'avai pas dit que l'on avait dissimulé une bombe à fragementation de Base de Données à l'interieur de TAG?

Share this post


: post
Share on other sites

Posted · Report post

:D :lol: :) :)

Share this post


: post
Share on other sites

Posted · Report post

Nan moi c'est un cheval de troyes :)

Willy

Share this post


: post
Share on other sites

Posted · Report post

:) mouais :)

n'empeche que bientot il va mettre la partie admin dans son autre post, en gros willy c'est les deux pages plus haut avec juste le nom du champs qui enregistre si il doit afficher ou non à modifier par copier/coller...

Share this post


: post
Share on other sites

Posted · Report post

:) mouais :)

n'empeche que bientot il va mettre la partie admin dans son autre post, en gros willy c'est les deux pages plus haut avec juste le nom du champs qui enregistre si il doit afficher ou non à modifier par copier/coller...

J'aicréer un autre Message pour plus de clarté, je ne voulais pas te froissé!!

Share this post


: post
Share on other sites

Posted · Report post

rohhh.. pas de problème, ne t'inquiete pas, je ne froisse pas :)

Share this post


: post
Share on other sites

Posted · Report post

Euh c'est sympa pour le code, mais j'ai incorporé les fichiers administer/Tags.php et administer/modeles/Tags_liste.php mais je 'ai rien ni du côté admin ni du côté du site... j'ai oublié quelque chose mais quoi ????

Merci pour vos lumières, car moi je suis éteint là :) ;) ;)

Share this post


: post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

Twitter Advisto ecommerce

Facebook PEEL Shopping