Helpful Information
 
 
Category: vBulletin 3.0 Beta Releases
Forum in Focus

Posting this here, as I believe you're meant to do first off. Plus it could probably be improved a touch. Thought I would share it anyway.

Basically it is for use with portals, as it gives some indication of what each forum is. Handy if people pass by your front page and haven't visited your forums yet, as it gives a description of an individual forum after the title.

Anyway, here's the code:

<?
// this line needs to be set to point to your config.php file.
include("$DOCUMENT_ROOT/forums/includes/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);

// set admin forum
$adminforum = 1;

// MySql query
$sql =mysql_query("SELECT * FROM forum WHERE forumid != $adminforum AND displayorder != 0 AND threadcount > 1 ORDER BY RAND() LIMIT 1");

// Loop out of DB & PHP, into HTML
while ($news = mysql_fetch_array($sql)){

$forumid = $news["forumid"];
$forumname = $news["title"];
$forumdes = $news["description"];
}
mysql_free_result($sql);


echo "<table width=\"100%\" border=\"0\"><tr><td align=\"center\"><font class=\"feed\"><b><a href=\"/forums/forumdisplay.php?f=$forumid\">$forumname</a></b></font></td></tr><tr><td align=\"left\"><font class=\"feed\">$forumdes</font></td></tr></table>";
?>

Screen Shot please. :)

i think you meant for this to be in beta hacks?

Edit:\ weird its showing up as 'latest hack' on mainpage

Posting this here, as I believe you're meant to do first off. Plus it could probably be improved a touch. Thought I would share it anyway.

Basically it is for use with portals, as it gives some indication of what each forum is. Handy if people pass by your front page and haven't visited your forums yet, as it gives a description of an individual forum after the title.

Anyway, here's the code:

<?
// this line needs to be set to point to your config.php file.
include("$DOCUMENT_ROOT/forums/includes/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassword);
mysql_select_db($dbname);

// set admin forum
$adminforum = 1;

// MySql query
$sql =mysql_query("SELECT * FROM forum WHERE forumid != $adminforum AND displayorder != 0 AND threadcount > 1 ORDER BY RAND() LIMIT 1");

// Loop out of DB & PHP, into HTML
while ($news = mysql_fetch_array($sql)){

$forumid = $news["forumid"];
$forumname = $news["title"];
$forumdes = $news["description"];
}
mysql_free_result($sql);


echo "<table width=\"100%\" border=\"0\"><tr><td align=\"center\"><font class=\"feed\"><b><a href=\"/forums/forumdisplay.php?f=$forumid\">$forumname</a></b></font></td></tr><tr><td align=\"left\"><font class=\"feed\">$forumdes</font></td></tr></table>";
?>

Some of us have more than I admin forum, adminforum should be a comma separated list and the query should be and forumid not in ($adminforum), or something like that :)

Also, you should really include global.php to have the standard $DB_site object and to use all the forum usergroup constraints.

Screenie shotty please

Screenie shotty please
There isn't much to take a screenshot of: this piece of code simply randomly selects one forum on your board and displays a table *ick* with the forumname and its description.

It doesn't use templates, and isn't of much use on its own - it needs to be used in your already existant portal.

Some info and a demo site would be just fine ...










privacy (GDPR)