The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
upgraded to vb, trying to re-install my previous feature Details »» | |||||||||||||||||||||||||||
upgraded to vb, trying to re-install my previous feature
Developer Last Online: Apr 2008
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 Show Your Support
|
Comments |
#2
|
||||
|
||||
you'll have to edit index.php and there the makeforumbit function...
just before this line: PHP Code:
|
#3
|
|||
|
|||
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: Code:
if ($forumid=="23"){ $temp = include("topt.php"); $forum[title] = "$forum[title] - $temp"; } I hope you can understand what I am trying to do, I find it difficult trying to explain this! |
#4
|
||||
|
||||
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 |
#5
|
|||
|
|||
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.
Code:
<? $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()); ?> |
#6
|
||||
|
||||
You should change it to this:
Code:
<? $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 ?> |
#7
|
|||
|
|||
thanks, it works
had to make one change being: Code:
if ($forum[forumid]=="23"){ click link in my sig to see the final result many thanks for your help |
#8
|
||||
|
||||
you're welcome |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|