Page 2 sur 3

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Lun Avr 13, 2009 12:42 pm
par jpv
"je souhaiterais y faire également figurer la date et l'image du forum qui a été ajoutée"

De quelle image parles tu ?

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 14, 2009 5:27 am
par Yoyo
Oui et puis par défaut, chaque forum n'a pas une image spécifique il me semble, il faut donc te renseigner et apprendre à te servir du mod qui ajoute les images pour chaque forum et l'implémenter dans ce script !

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 14, 2009 11:52 am
par nicolas66000
Salut, ou alors affiché l'avatar, mais le voudrais vraiment que sa affiche la date, mais je comprend vraiment rien au php et je galere, j'ai essayé de le faire moi meme mais sa marche pas du tout lol

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mer Avr 15, 2009 11:43 pm
par nicolas66000
Personne pour me filer un coup de main donc ?

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Dim Avr 19, 2009 1:13 am
par nicolas66000
J'ai enfin trouver la solution pour afficher la date et l'heure, la voici pour se que cela interesse :

Code: Tout sélectionner


<?php

define
('IN_SITE', true);
define('IN_PHPBB', true);
$phpbb_root_path =  forum/';
$phpEx = substr(strrchr(__FILE__, '
.'), 1);
include($phpbb_root_path . '
common.' . $phpEx);
 
// Sélection des 10 derniers posts
$sql = "SELECT t.topic_replies_real,t.topic_replies,t.topic_title,t.forum_id,t.topic_id,t.topic_type,t.topic_last_post_id,f.forum_name,t.topic_last_poster_name,t.topic_last_post_time
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.topic_approved = 1 
AND t.topic_status <> 2
AND t.forum_id = f.forum_id
ORDER BY t.topic_last_post_time DESC 
LIMIT 6";
$result = $db->sql_query($sql);

// Boucle d'
affichage du post
while($topic_data = $db->sql_fetchrow($result)) 
{
    // Données du topic
    $topic_title = $topic_data['topic_title'];
    $topic_replies = $topic_data['topic_replies'];
    $topic_replies_real = $topic_data['topic_replies_real'];
    $forum_id = $topic_data['forum_id'];
    $topic_id = $topic_data['topic_id'];
    $forum_name = $topic_data['forum_name'];
    $topic_last_post_id = $topic_data['topic_last_post_id'];
    $topic_last_post_time = $topic_data['topic_last_post_time'];
    $topic_last_poster_name = $topic_data['topic_last_poster_name'];
       $replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_replies_real : $topic_replies; 
    $start 
= floor(($replies) / $config['posts_per_page']) * $config['posts_per_page']; 
    
    
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
    if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($line[$i]['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = $topic_title;
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
    }
    if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
    }
    // www.phpBB-SEO.com SEO TOOLKIT END 
   
    $post_url 
= append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id . '&amp;f=' . $forum_id . '&amp;start=' . $start ) . '#p' . $topic_last_post_id; 
    $topic_url 
= append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id . '&amp;f=' . $forum_id ); 

    
//On affiche
    echo '<li><a href="'.$topic_url.'">'.$topic_title.'</a> - '.$forum_name.' - <a rel="nofollow" href="'.$post_url.'">Dernier message par '.$topic_last_poster_name.'</a> - '.strftime('%d/%m/%y ',$topic_last_post_time).' &agrave; '.strftime('%H:%M ',$topic_last_post_time).'</li>';
}
$db->sql_freeresult($result);

?>

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 21, 2009 12:04 pm
par Yoyo
A oui désolé, pas trop eu le temps, je viens de voir ton mp lol Bah voila, c'est super ça :D

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mer Mai 20, 2009 2:33 am
par blackcat
Bonjour,

Merci pour ce super mod! j'aimerais savoir s'il était possible d'exclure à l'affichage certains forums ?

Merci d'avance et continuez comme ça ! :D

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Ven Mai 22, 2009 5:34 pm
par blackcat
Bonjour,

J'ai une autre question, est-ce possible d'afficher le nombre de réponse du sujet ?

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Sam Mai 23, 2009 5:48 am
par Yoyo
Salut, oui tout ça est faisable dans la requête SQL. Il suffit de rajouter des clauses WHERE avec ce que tu veux filtrer :)

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Juin 02, 2009 12:08 pm
par blackcat
Merci de ta réponse, tu aurais la possibilité de le faire s'il te plait :cry: Je suis nul en codage :cry:

Merci d'avance de ton aide précieux, il me manque plus que cette fonction... parce que là on voit tous les forums même ceux privés...


Thanks!!

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Ven Nov 06, 2009 12:26 am
par Maxime
Bonjour,

je m'occupe d'un petit site internet avec un forum phpBB2.

Je souhaite passer au phpBB3, mais avant, je veux apprendre a afficher les X derniers topics sur une page html (dans un calque par exemple), façon topics anywhere.

J'ai fait un premier essais avec les scripts de ce sujet, mais je galère un peu (complètement même). L'objectif est, comme sur ma page d'accueil, d'afficher les titres, auteur et date des 5 ou 10 derniers sujets.

J'aimerai pouvoir définir aussi certains forums (qui sont cachés, les forums administrateurs) qui ne devront pas apparaitre bien sur.

Ça donne ca : http://www.laryngo.com/chu_ecoles/test.html

Si quelqu'un peut me guider....

Merci d'avance

Maxime

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Ven Nov 06, 2009 2:52 pm
par Yoyo
Sans installation de phpBB3 tu ne peux pas y arriver !

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Ven Nov 06, 2009 5:08 pm
par Maxime
Le forum existe, il est ici

http://www.laryngo.com/chu_ecoles/forum/

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Jeu Nov 19, 2009 4:30 pm
par Voyageur
Yoyo a écrit://Script 1

Code: Tout sélectionner
<ul>
<?php

define
('IN_SITE', true);
define('IN_PHPBB', true);
$phpbb_root_path =  './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include(
$phpbb_root_path . 'common.' . $phpEx);
 
// Sélection des 10 derniers posts
$sql = "SELECT topic_replies_real,topic_replies,topic_title,forum_id,topic_id,topic_type,topic_last_post_id
FROM phpbb3_topics 
WHERE topic_approved = 1 
ORDER BY topic_last_post_time DESC 
LIMIT 10"
;
$result = $db->sql_query($sql);

// Boucle d'affichage du post
while($topic_data = $db->sql_fetchrow($result)) 
{
    // Données du topic
    $topic_title = $topic_data['topic_title'];
    $topic_replies = $topic_data['topic_replies'];
    $topic_replies_real = $topic_data['topic_replies_real'];
    $forum_id = $topic_data['forum_id'];
    $topic_id = $topic_data['topic_id'];
    $topic_last_post_id = $topic_data['topic_last_post_id'];
       $replies = ($auth->acl_get('m_approve', $forum_id)) ? $topic_replies_real : $topic_replies; 
    $start 
= floor(($replies) / $config['posts_per_page']) * $config['posts_per_page']; 
    
    
// www.phpBB-SEO.com SEO TOOLKIT BEGIN, à enlever si vous n'avez pas installé les mods phpbb-seo !
    if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if ($line[$i]['topic_type'] == POST_GLOBAL) {
         $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      $phpbb_seo->seo_censored[$topic_id] = $topic_title;
      $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
    }
    if ( empty($phpbb_seo->seo_url['forum'][$forum_id]) ) {
      $phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id, $phpbb_seo->seo_static['forum']);
    }
    // www.phpBB-SEO.com SEO TOOLKIT END 
   
    $post_url 
= append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id . '&amp;f=' . $forum_id . '&amp;start=' . $start ) . '#p' . $topic_last_post_id; 

    
//On affiche
    echo '<li><a href="'.$post_url.'">'.$topic_title.'</a></li>';

}
$db->sql_freeresult($result);

?>
</ul>


Bonjour,

Merci pour ce script.
Je souhaiterais l'adapter afin qu’il affiche la bonne url suivant l’url-rewritting mis en place.
Je m’explique :
L’url de ce code affiche : http://www.nomdedomaine.com/forum/topic.htm
Comment modifier ce code pour que l’url s’affiche de cette manière :
http://www.nomdedomaine.com/forum/nomduforum/topic-t1.htm

D’avance merci
Michaël

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Fév 02, 2010 9:05 am
par pixels78
Bonjour,
je suis newbie en html et php pouvez vous m'indiquer quel fichier dois-je modifier et à quel niveau dois-je l' insérer ?

merci par avance de votre aide

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Ven Fév 05, 2010 3:18 pm
par Yoyo
Comme l'a dit dcz sur son forum phpbb-seo.com . Il y a eu des modifications.

Voici ses préconisations au niveau de ce script:

Remplacer:
Code: Tout sélectionner
if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
   if ($topic_data['topic_type'] == POST_GLOBAL) {
      $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
   }
   $phpbb_seo->seo_censored[$topic_id] = censor_text($topic_data['topic_title']);
   $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
}
 


Par:
Code: Tout sélectionner
// http://www.phpBB-SEO.com SEO TOOLKIT BEGIN
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
if (empty($phpbb_seo->seo_opt['virtual_folder'] || !empty($phpbb_seo->seo_url['forum'][$forum_id]) || $topic_data['topic_type'] == POST_GLOBAL) {
   $phpbb_seo->prepare_iurl($topic_data, 'topic', $topic_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]);
}
// http://www.phpBB-SEO.com SEO TOOLKIT END  


Voila, donc tu adaptes ces modifications à ton script. les noms de variables ne sont pas les mêmes à 100% j'imagine.

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Fév 09, 2010 7:53 pm
par pixels78
Yoyo a écrit:Comme l'a dit dcz sur son forum phpbb-seo.com . Il y a eu des modifications.

Voici ses préconisations au niveau de ce script:

Remplacer:
Code: Tout sélectionner
if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
   if ($topic_data['topic_type'] == POST_GLOBAL) {
      $phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
   }
   $phpbb_seo->seo_censored[$topic_id] = censor_text($topic_data['topic_title']);
   $phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
}
 


Par:
Code: Tout sélectionner
// http://www.phpBB-SEO.com SEO TOOLKIT BEGIN
$topic_data['topic_title'] = censor_text($topic_data['topic_title']);
if (empty($phpbb_seo->seo_opt['virtual_folder'] || !empty($phpbb_seo->seo_url['forum'][$forum_id]) || $topic_data['topic_type'] == POST_GLOBAL) {
   $phpbb_seo->prepare_iurl($topic_data, 'topic', $topic_data['topic_type'] == POST_GLOBAL ? $phpbb_seo->seo_static['global_announce'] : $phpbb_seo->seo_url['forum'][$forum_id]);
}
// http://www.phpBB-SEO.com SEO TOOLKIT END   


Voila, donc tu adaptes ces modifications à ton script. les noms de variables ne sont pas les mêmes à 100% j'imagine.


merci je vais essayer et te tiens au courant

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 27, 2010 9:19 pm
par Maxime
J'ai un message d'erreur en installant le script sur mon forum situé a cette adresse
http://www.laryngo.com/projet/

Parse error: syntax error, unexpected '?' in /home/laryngo/public_html/test.htm on line 98


La ligne 98 est :
Code: Tout sélectionner
echo '<li><a href="'.$post_url.'">'.$topic_title????A?.'</a></li>'; 


Le script complet utilisé
Code: Tout sélectionner
<?php

define
('IN_SITE'true);
define('IN_PHPBB'true);
$phpbb_root_path =  './projet/';
$phpEx substr(strrchr(__FILE__'.'), 1);
include(
$phpbb_root_path 'common.' $phpEx);
 
// Sélection des 10 derniers posts
$sql "SELECT topic_replies_real,topic_replies,topic_title,forum_id,topic_id,topic_type,topic_last_post_id
FROM phpbb3_topics 
WHERE topic_approved = 1 
ORDER BY topic_last_post_time DESC 
LIMIT 10"
;
$result $db->sql_query($sql);

// Boucle d'affichage du post
while($topic_data $db->sql_fetchrow($result)) 
{
    
// Données du topic
    
$topic_title $topic_data['topic_title'];
    
$topic_replies $topic_data['topic_replies'];
    
$topic_replies_real $topic_data['topic_replies_real'];
    
$forum_id $topic_data['forum_id'];
    
$topic_id $topic_data['topic_id'];
    
$topic_last_post_id $topic_data['topic_last_post_id'];
       
$replies = ($auth->acl_get('m_approve'$forum_id)) ? $topic_replies_real $topic_replies
    
$start floor(($replies) / $config['posts_per_page']) * $config['posts_per_page']; 
    
    
// www.phpBB-SEO.com SEO TOOLKIT BEGIN, à enlever si vous n'avez pas installé les mods phpbb-seo !
    
if ( empty($phpbb_seo->seo_url['topic'][$topic_id]) ) {
      if (
$line[$i]['topic_type'] == POST_GLOBAL) {
         
$phpbb_seo->seo_opt['topic_type'][$topic_id] = POST_GLOBAL;
      }
      
$phpbb_seo->seo_censored[$topic_id] = $topic_title;
      
$phpbb_seo->seo_url['topic'][$topic_id] = $phpbb_seo->format_url($phpbb_seo->seo_censored[$topic_id]);
    }
    if ( empty(
$phpbb_seo->seo_url['forum'][$forum_id]) ) {
      
$phpbb_seo->seo_url['forum'][$forum_id] = $phpbb_seo->set_url($line[$i]['forum_name'], $forum_id$phpbb_seo->seo_static['forum']);
    }
    
// www.phpBB-SEO.com SEO TOOLKIT END 
   
    
$post_url append_sid("{$phpbb_root_path}viewtopic.$phpEx"'t=' $topic_id '&amp;f=' $forum_id '&amp;start=' $start ) . '#p' $topic_last_post_id

    
//On affiche
    
echo '<li><a href="'.$post_url.'">'.$topic_title????A?.'</a></li>';

}
$db->sql_freeresult($result);

?>



Merci d'avance pour votre aide

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 27, 2010 9:35 pm
par Yoyo
Salut, il faut regarder ce qui cloche dans la ligne:

Code: Tout sélectionner
    echo '<li><a href="'.$post_url.'">'.$topic_title????A?.'</a></li>';  


Il s'agit de la variable qui contient un nom très bizarre ^^

Cette ligne irait mieux:
Code: Tout sélectionner

 
echo '<li><a href="'.$post_url.'">'.$topic_title.'</a></li>'

Re: MOD Topic anywhere pour phpbb3

MessagePosté: Mar Avr 27, 2010 9:56 pm
par Maxime
Effedctivement, cet erreur est curieuse car j'ai juste copié/collé le code du début du sujet, mais bon...

En rectifiant, ca donne ca
Warning: include(./projet/common.htm) [function.include]: failed to open stream: No such file or directory in /home/laryngo/public_html/test.htm on line 59

Warning: include(./projet/common.htm) [function.include]: failed to open stream: No such file or directory in /home/laryngo/public_html/test.htm on line 59

Warning: include() [function.include]: Failed opening './projet/common.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/laryngo/public_html/test.htm on line 59

Fatal error: Call to a member function sql_query() on a non-object in /home/laryngo/public_html/test.htm on line 67


Ligne 59
Code: Tout sélectionner
include($phpbb_root_path . 'common.' . $phpEx); 


Ligne 67
Code: Tout sélectionner
$result = $db->sql_query($sql); 


Il y a un fichier common.php dans le repertoire projet, mais pas common.htm