Help - Search - Member List - Calendar
Full Version: Lister les topics des forums
IPBR-FR > Entraide > Forums dédiés aux mods majeures > IPB SDK
broly
Bonjour à tous,

J'ai une petite requête à vous soumettre, j'ai installer l'exemple du SDK 1.5 beta 3 intitulé "forumslist.php", il fonctionne nickel bien sûr mais j'aimerais que quand il me liste les forums, qu'au lieu qu'il me pointe vers la version web, qu'il utilise le skin de l'exemple c'est à dire que du texte sans rien.
Je vous mets le code du fichier en question : "forumslist.php"

CODE
<?
/**
* IPB SDK Code Snippet - Forums Listing
* Copyright (C) 2003 Global Centre Scripting
* Designed for IPB SDK 1.0
*
* This script displays a list of forums viewable by the
* currently logged in member.
*
* @author Cow <khlo@global-centre.com>
* @date   21.03.2004
*/

// Load and Start IPB SDK
require_once "./ipbsdk/ipbsdk_class.inc.php";
$SDK =& new IPBSDK();

$forums = $SDK->get_member_readable_forums(); // Get array of readable forums
$categories = array(); // Make blank categories array for later usage
$categorynames = array();

// Cycle through the forums, putting Forum IDs in $categories
foreach ($forums as $i) {
if($i['parent_id'] != "-1")
{
$categories[$i['parent_id']][] = $i['id'];
}
if (!$categorynames[$i['parent_id']]) {
 $categorynames[$i['parent_id']] = $i['category_name'];
}
}

// Ok, lets go through the categories displaying it's name, and forums
foreach ($categories as $j => $k) {
echo '<br /><strong>'.$categorynames[$j].'</strong><br />';
foreach ($k as $l) {
 if ($forums[$l]['parent_id'] == $j) {
  echo '<a href="'.$board_url.'index.php?showforum='.$l.'">'.$forums[$l]['name'].'</a><br />';
 }
}
}
?>


J'espère que je me suis bien exprimé, sinon n'hésitez pas à me le faire savoir.
Merci smile.gif

voici un lien vers le site en question : http://forums.astel.be/forumslist.php
broly
Toujours dans les fichiers d'exemple, il y a un fichier nommer "topiclist.php"
Si ça peut vous aider, voici son code source :

CODE
<?
/**
* IPB SDK Code Snippet - List Topics
* Copyright (C) 2003 Global Centre Scripting
* Designed for IPB SDK 1.0
*
* Lists Topics in a Forum.
*
* @author Cow <khlo@global-centre.com>
* @date   23/11/03
*/

// Load and Start IPB SDK
require_once "./ipbsdk/ipbsdk_class.inc.php";
$SDK =& new IPBSDK();

// fetch single forum with forum ID 1
$forumid = 1;

/* or many forums with an array
  uncomment the next line, and modify the numbers
  if you have less then three forums;-) */

// $forumid = array(2,1,3);

if ($topics = $SDK->list_forum_topics($forumid)) {
if (count($topics)) {
 foreach ($topics as $i) {
  echo '<a href="'.$SDK->board_url.'?showtopic='.$i['tid'].'">'.$i['title'].'</a><br />';
 }
}
}
else {
if (count($topics) == 0) {
 if (is_array($forumid)) $forumid = implode(',', $forumid);
 echo 'No matching topics for the forum ID(s) :' . $forumid;
} else {
 echo 'Error: '.$SDK->sdk_error();
}
}
?>
<hr />
<?php
IPBSDK::dbg_print($topics, 30, 'Debug output of $topics in ' . __FILE__);
?>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.