Bonjour,
Je m'en remet a vous car j'ai un petit soucis avec une class trouvé sur developpez.net

Source : http://a-pellegrini.developpez.com/t...php/templates/

Je ne parvient pas a sortir les données et utilisé le template.
Ma logique ne convient pas, peut-être que la votre sera m'aider ?


PS : C'est la seul page avec laquelle j'ai des difficultés due a l'imbrication des données.
Merci de commenté le script final afin que je puisse le comprendre.

Voici mon template :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
<table width="95%" border="1">
<tr class="for-titre-haut">
	<td colspan="2">&nbsp;Forum Catégorie&nbsp;</td>
	<td>&nbsp;Sujets&nbsp;</td>
	<td>&nbsp;Messages&nbsp;</td>
	<td>&nbsp;Dernier message&nbsp;</td>
</tr>
<!-- BEGIN forum -->
<tr class="for-titre-haut" id="c{forum.FORUM_ID}">
	<td align="center" colspan="5">&nbsp;{forum.FORUM_NOM}&nbsp;</td>
</tr>
	<!-- BEGIN champ -->
	<tr class="mp_title_{champ.bgcolor}">
		<td>&nbsp;<img src="{champ.ICON}" alt="message" />&nbsp;</td>
		<td>&nbsp;<a href="{champ.FORUM_LIEN}">{champ.FORUM_TITRE}</a><br />{champ.FORUM_DESC}&nbsp;</td>
		<td class="nbmessages">&nbsp;{champ.TOPICS}&nbsp;</td>
		<td class="nbmessages">&nbsp;{champ.POSTS}&nbsp;</td>
		<td class="derniermessage">&nbsp;{champ.LAST_POST}&nbsp;</td>
	</tr>
	<!-- END champ -->
<!-- END forum -->
</table>
et enfin mon script avec le template :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 
<?php
/*************************************************************/
/*  Projet Bianca forum										 */
/*  Réalisé par Christophe BUFFET @ : chbube@gmail.com		 */
/*************************************************************/
require_once("app/actions/_xForm.php");
$fil = Nap::filarian('', "<a href=\"".$systeme['nap']['serveur']."/forum\">Forums</a>");
@Nap::sitemap_add('');
$titre_page="Bienvenue sur le Forum.";
$content_page='<div id="OStitre"><div class="montitre">'.$titre_page.'</div></div>';
$fil = Nap::filarian('','<a href="'.$systeme['nap']['serveur'].'/forum">Forums</a>');
$content_page.= $fil;
//Initialisation de deux variables
$totaldesmessages = 0;
$categorie = NULL;
//Déterminons le niveau d'accès du visiteur
$level = (isset($_SESSION['user']['level']))?intval($_SESSION['user']['level']):1;
//Cette requete permet d'obtenir tout sur le forum
$forum_list = mysql_query('SELECT cat_id, cat_nom, OS_forum_forum.forum_id, forum_name, forum_desc, forum_post, forum_topic, auth_view, OS_forum_topic.topic_id, topic_titre, OS_forum_topic.topic_post, post_id, post_time, post_createur, membre_pseudo, membre_id
FROM OS_forum_categorie
LEFT JOIN OS_forum_forum ON OS_forum_categorie.cat_id = OS_forum_forum.forum_cat_id
LEFT JOIN OS_forum_post ON OS_forum_post.post_id = OS_forum_forum.forum_last_post_id
LEFT JOIN OS_forum_topic ON OS_forum_topic.topic_id = OS_forum_post.topic_id
LEFT JOIN OS_membres ON OS_membres.membre_id = OS_forum_post.post_createur
WHERE auth_view < '.$level.'
ORDER BY cat_ordre, forum_ordre DESC')or die(mysql_error());
//Dans un premier temps, on vérifie s'il y a des forums à lister
if (mysql_num_rows($forum_list) < 1)
{
$content_page.='Il n y a pas de forum :o Allez en ajouter avec le panneau d administration';
}
else
{
$content_page.='<table cellspacing="0" width="100%">
<tr class="for-titre-haut"><th></th><th>Catégorie</th><th width="75">Sujets</th><th width="75">Messages</th><th width="175">Dernier message</th></tr>';
//Début de la boucle
while($data = mysql_fetch_assoc($forum_list))
{
//On affiche chaque catégorie
if( $categorie != $data['cat_id'] )
{
//Si c'est une nouvelle catégorie on l'affiche
$categorie = $data['cat_id'];
$content_page.='<tr class="for-titre" id="c'.Securite::html($data['cat_id']).'"><th></th><th align=left>'.Securite::html($data['cat_nom']).'</th><th width="75">Sujets</th><th width="75">Messages</th><th width="175">Dernier message</th></tr>';
}
//Ici, on met le contenu de chaque catégorie
// les forums en détail : description, nombre de réponses etc...
	if (Nap::verif_auth($data['auth_view']))
	{
	//Affichage des forums
		$content_page.='<tr class="for-content"><td><img src="'.$systeme['nap']['serveur'].'/assets/images/forum/forum_read.gif" alt="message" /></td>
		<td onClick="javascript:window.open(\'forum-'.url_encode(Securite::html($data['forum_name'])).'-'.$data['forum_id'].'\',\'_self\')" style="cursor:pointer;"><span class="for-topic">
		<a href="'.$systeme['nap']['serveur'].'/forum-'.url_encode(Securite::html($data['forum_name'])).'-'.$data['forum_id'].'">
		'.Securite::html($data['forum_name']).'</a></span>
		<br />'.nl2br(stripslashes($data['forum_desc'])).'</td>
		<td class="for-nbsujets">'.number_format($data['forum_topic'], 0, '', ' ').'</td>
		<td class="for-nbmessages">'.number_format($data['forum_post'], 0, '', ' ').'</td>';
		// Deux cas possibles :
		// Soit il y a un nouveau message, soit le forum est vide
		if (!empty($data['forum_post']))
		{
		//Selection dernier message
		$nombreDeMessagesParPage = 15;
		$nbr_post = $data['topic_post'] +1;
		$page = ceil($nbr_post / $nombreDeMessagesParPage);
		$content_page.='<td class="derniermessage">De <a href="'.$systeme['nap']['serveur'].'/profil-'.url_encode(Securite::html($data['membre_pseudo'])).'-'.Securite::html($data['membre_id']).'">'.Securite::html($data['membre_pseudo']).'</a>
		dans <a href="'.$systeme['nap']['serveur'].'/topic-'.url_encode(Securite::html($data['topic_titre'])).'-'.$data['topic_id'].'-'.$page.'#p_'.$data['post_id'].'">'.Securite::html($data['topic_titre']).'
		<img src="'.$systeme['nap']['serveur'].'/assets/images/forum/go.gif" alt="go" title="go" /></a><br />
		'.Nap::getRelativeTime($data['post_time']).'		 
		</td></tr>';
		}
		else
		{
		$content_page.='<td class="nbmessages">Pas de message</td></tr>';
		}
	}//Fin de la vérification d'autorisation
//Cette variable stock le nombre de message, on la met à jour
$totaldesmessages += $data['forum_post'];
//On ferme notre boucle et nos balises
} //fin de la boucle
$content_page.= '</table>';
mysql_free_result($forum_list);
} //fin du else
?>
Merci.