PDA

View Full Version : upgraded to vb, trying to re-install my previous feature


Shepski
08-05-2002, 10:34 AM
Hi all,

On my last board (XMB) I changed the main forum home code to display next to one of the categories (Trading) a list of top traders. This list was generated by me adding into the XMB code where it makes up the forum list to 'include' a php file if the forumid equalled the one for the trading forum. this then pulled the info from another database and then displayed it by the side of the trading forum name.

Unfortunaltely, I have deleted my original board before checking how i did it but with vb I am struggling to find where to put the code. Can anyone point me in the right direction to do this?

thanks

Xenon
08-05-2002, 11:42 AM
you'll have to edit index.php and there the makeforumbit function...

just before this line:eval("\$forumbits .= \"".gettemplate("forumhome_forumbit_level$depth$tempext")."\";");

Shepski
08-05-2002, 12:13 PM
thanks for that.

I have been trying to get it working but i cant seem to figure out how to add the data next to the category name. all it seems to do so far is try and add the data to every forum within the category.

take a look at my forum home page, I am trying to get the 'include'ed file to display next to DVD Related which is a category but has forum number 23. here is my inserted code:


if ($forumid=="23"){
$temp = include("topt.php");
$forum[title] = "$forum[title] - $temp";
}


to see what data i will be displaying next to category name click here (http://www.dvd-swaps.co.uk/dvd2001/dvdforums/topt.php)

I hope you can understand what I am trying to do, I find it difficult trying to explain this!

Xenon
08-05-2002, 12:21 PM
have your topt.php a return function in it?
http://www.php.net/manual/en/function.include.php
if not you've to add it...

also it would help to share your topt.php with use, so we can give better advices

Shepski
08-05-2002, 12:40 PM
I didnt use return (mainly cos i didnt know it existed!) but i did have to reconnect back to the forums database. This code worked when used with XMB.


<?
$i = 0;
$count = 0;

$link2=mysql_pconnect("host", "user", "pass");
mysql_select_db('dbname',$link2);
$query="SELECT n0s_users.id, n0s_users.fname, COUNT(n0s_comments.uid) AS comments
FROM n0s_users INNER JOIN n0s_comments ON (n0s_users.id=n0s_comments.uid)
GROUP BY n0s_users.id ORDER BY comments DESC, n0s_users.fname ASC LIMIT 10";

$result=mysql_query($query) or die(mysql_error());
$numrows=mysql_num_rows($result);

if ($numrows!=0) {
while($row=mysql_fetch_assoc($result)) {
$count = $count + 1;
if ($count==10){
echo "<span style=\"font-size: 8pt;\">$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\" target=_blank>$row[fname]</a></span>";
} else {
echo "<span style=\"font-size: 8pt;\">$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\" target=_blank>$row[fname]</a> - </span>";
}
// echo "$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\">$row[fname]</a> - <b>$row[comments]</b> ";

}
}
//reconnect to orginal forum database
mysql_pconnect('host', 'username', 'password') or die(mysql_error());
mysql_select_db('dbname') or die(mysql_error());
?>

Xenon
08-05-2002, 01:47 PM
You should change it to this:


<?
$i = 0;
$count = 0;
$temp="";

$link2=mysql_pconnect("host", "user", "pass");
mysql_select_db('dbname',$link2);
$query="SELECT n0s_users.id, n0s_users.fname, COUNT(n0s_comments.uid) AS comments
FROM n0s_users INNER JOIN n0s_comments ON (n0s_users.id=n0s_comments.uid)
GROUP BY n0s_users.id ORDER BY comments DESC, n0s_users.fname ASC LIMIT 10";

$result=mysql_query($query) or die(mysql_error());
$numrows=mysql_num_rows($result);

if ($numrows!=0) {
while($row=mysql_fetch_assoc($result)) {
$count = $count + 1;
if ($count==10){
$temp .= "<span style=\"font-size: 8pt;\">$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\" target=_blank>$row[fname]</a></span>";
} else {
$temp .= "<span style=\"font-size: 8pt;\">$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\" target=_blank>$row[fname]</a> - </span>";
}
// echo "$count <a href=\"http://users.dvd-swaps.co.uk/user.php?id=$row[id]\">$row[fname]</a> - <b>$row[comments]</b> ";

}
}
//reconnect to orginal forum database
mysql_pconnect('host', 'username', 'password') or die(mysql_error());
mysql_select_db('dbname') or die(mysql_error());

return $temp
?>


then it should work

Shepski
08-05-2002, 02:37 PM
thanks, it works :)

had to make one change being:


if ($forum[forumid]=="23"){


so it now displays next to the category

click link in my sig to see the final result :)

many thanks for your help

Xenon
08-06-2002, 01:39 AM
:)
you're welcome