Le site des utilisateurs francophones de FluxBB.
Vous n'êtes pas identifié(e).
Bonjour a tous et à toute(s)
Voila J'ai ajouté un blocktable dans viewforum.php qui me liste le contenu de mes annonces globales à partir d'une table bdd
CREATE TABLE `f_fluxbb_announcements` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`subject` varchar(50) NOT NULL DEFAULT 'Announcement Title',
`message` text NOT NULL,
`user_id` int(10) unsigned NOT NULL DEFAULT '2',
`posted` int(10) unsigned NOT NULL DEFAULT '0',
`num_views` mediumint(8) unsigned NOT NULL DEFAULT '0',
`num_replies` mediumint(8) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;Ces contenus sont affichés dans tout les categories de forums, mon problème est que je ne sais pas comment affiché aux membres s'ils ont déjà lue ou non ces annonces...
viewforum.php
$result = $db->query('SELECT c.id AS cid, c.subject, c.message, c.user_id, c.posted, c.num_views, c.num_replies, u.id, u.group_id, u.username FROM '.$db->prefix.'announcements AS c LEFT JOIN '.$db->prefix.'users AS u ON u.id=c.user_id ORDER BY id DESC') or error('Unable to fetch forum announcements', __FILE__, __LINE__, $db->error());
if($db->num_rows($result))
{
?>
<div id="vfannounce" class="blocktable">
<h2><span><?php echo pun_htmlspecialchars($cur_forum['forum_name']) ?></span></h2>
<div class="box">
<div class="inbox">
<table>
<thead>
<tr>
<th class="tcl" scope="col"><?php echo $lang_common['Global Announcement'] ?></th>
<th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
<?php if ($pun_config['o_topic_views'] == '1'): ?>
<th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
<?php endif; ?>
<th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
</tr>
</thead>
<tbody>
<?php
$topic_count = 0;
while ($announcement = $db->fetch_assoc($result))
{
++$topic_count;
$status_text = array();
$item_status = ($topic_count % 2 == 0) ? 'roweven' : 'rowodd';
$icon_type = 't-icon';
$item_status .= ' iclosed';
$item_status .= ' iannounceg';
$status_text[] = '<span class="iannouncetext">'.$lang_common['Global Announcement'].' : </span>';
$subject = '<a href="announcement.php?id='.$announcement['cid'].'&fid='.$id.'">'.pun_htmlspecialchars($announcement['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.$announcement['username'].' » '.format_time($announcement['posted']).'</span>';
// Insert the status text before the subject
$subject = implode(' ', $status_text).' '.$subject;
$last_post = '<a href="announcement.php?id='.$announcement['cid'].'&fid='.$id.'">'.format_time($announcement['posted']).'</a> <span class="byuser">'.$lang_common['by'].' '.$announcement['username'].'</span>';
?>
<tr class="<?php echo $item_status ?>">
<td class="tcl">
<div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo forum_number_format($topic_count) ?></div></div>
<div class="tclcon">
<div>
<?php echo $subject."\n" ?>
</div>
</div>
</td>
<td class="tc2"><?php echo (is_null($cur_topic['moved_to'])) ? forum_number_format($announcement['num_replies']) : '-' ?></td>
<?php if ($pun_config['o_topic_views'] == '1'): ?>
<td class="tc3"><?php echo (is_null($cur_topic['moved_to'])) ? forum_number_format($announcement['num_views']) : '-' ?></td>
<?php endif; ?>
<td class="tcr"><?php echo $last_post ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
<?php
}Merci encore de m'éclairé sur la marche à suivre...
Voilà un lien pour voir ce que j'ai fait
Cordialement Akira
Dernière modification par akira_87 (06-10-2016 18:11:22)
function j_ai_besoin() {
if (ça existe) j'utilise;
if (ça existe mais c'est incomplet) j'améliore et je partage;
if (ça n'existe pas) je développe et je partage;
if (je réclame) exit;
Return "code amélioré" or "developpeur satisfait" or die;}
Hors ligne
Bonjour,
Vous pouvez utiliser l'astuce suivante, qui a été améliorée dans les messages suivants : http://fluxbb.fr/forums/viewtopic.php?id=12042
Nous ne faisons pas le travail à votre place mais nous prenons le temps de vous montrer le chemin. Merci de lire ce que l'on vous dit et de réfléchir avant de re-demander une explication.
Hors ligne
A oui comme d'habitude rapide et efficace tes réponses...
Merci
Dernière modification par akira_87 (13-10-2016 23:18:41)
function j_ai_besoin() {
if (ça existe) j'utilise;
if (ça existe mais c'est incomplet) j'améliore et je partage;
if (ça n'existe pas) je développe et je partage;
if (je réclame) exit;
Return "code amélioré" or "developpeur satisfait" or die;}
Hors ligne