FASherman
09-04-2002, 10:00 PM
This is far from integrating the two products, but at least it makes your auctions visible on forumhome.
Sample can be seen at http://www.fasherman.com/forums
Simply, the auction table gives a link to the auctions, tells how many are active and what the newest auction is. The lightbulb is turned on if there are active auctions.
You'll need to edit index.php and create a new template. The instructions are below. Follow them exactly since you will be momentarily switching from your vBulletin database to your phpauction database and then back again.
in index.php, find:
require('./global.php');
Above it add:
$phpauction_host="your-db-host";
$phpauction_user="your-db-user";
$phpauction_passwd="your-db-password";
$phpauction_db="your-phpauction-db";
still in index.php, find:
eval("dooutput(\"".gettemplate('forumhome')."\");");
Above it, add:
//PHPAUCTION HACK
$link = mysql_connect($phpauction_host,$phpauction_user,$p hpauction_passwd);
mysql_select_db($phpauction_db);
/* Performing SQL query */
$query = "SELECT * FROM PHPAUCTION_auctions where closed=0";
$result = mysql_query($query);
$num_auctions=mysql_num_rows($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$newest=stripslashes($row[2]);
$num_category=$row[6];
}
$query = "SELECT * FROM PHPAUCTION_categories where cat_id=$num_category";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$category=$row[2];
}
if ($num_auctions !=0) {
$auctiononoff="on.gif";
} else {
$auctiononoff="off.gif";
}
mysql_select_db($dbname);
eval("\$auctiondisplay = \"".gettemplate('auctiondisplay')."\";");
//PHPAUCTION HACK END
Now, add a template called auctiondisplay:
<table cellSpacing="0" cellPadding="0" width="100%" align="center" bgColor="#1D6AA0" border="0">
<tr>
<td>
<table cellSpacing="1" cellPadding="4" width="100%" border="0">
<tr id="cat">
<td bgColor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif" colSpan="2">
<b>Web Auction</b></td>
</tr>
<tr align="middle">
<td vAlign="top" bgColor="#1C5780" width="15">
<img alt src="images/$auctiononoff" border="0" width="15" height="15"></td>
<td align="left" bgColor="#13486D">
<normalfont>
<img alt src="images/forum-icons/gavel.gif" border="0" width="32" height="32"><b>
<a style="color: #000020" href="../phpauction">Forum Web Auction</a> - </b>
<smallfont>lets you buy or sell items in an auction format<br>
<b>Number of active auctions</b>: $num_auctions<br>
<b>Newest Auction</b>: $category: $newest</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
Thats it.
Sample can be seen at http://www.fasherman.com/forums
Simply, the auction table gives a link to the auctions, tells how many are active and what the newest auction is. The lightbulb is turned on if there are active auctions.
You'll need to edit index.php and create a new template. The instructions are below. Follow them exactly since you will be momentarily switching from your vBulletin database to your phpauction database and then back again.
in index.php, find:
require('./global.php');
Above it add:
$phpauction_host="your-db-host";
$phpauction_user="your-db-user";
$phpauction_passwd="your-db-password";
$phpauction_db="your-phpauction-db";
still in index.php, find:
eval("dooutput(\"".gettemplate('forumhome')."\");");
Above it, add:
//PHPAUCTION HACK
$link = mysql_connect($phpauction_host,$phpauction_user,$p hpauction_passwd);
mysql_select_db($phpauction_db);
/* Performing SQL query */
$query = "SELECT * FROM PHPAUCTION_auctions where closed=0";
$result = mysql_query($query);
$num_auctions=mysql_num_rows($result);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$newest=stripslashes($row[2]);
$num_category=$row[6];
}
$query = "SELECT * FROM PHPAUCTION_categories where cat_id=$num_category";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
$category=$row[2];
}
if ($num_auctions !=0) {
$auctiononoff="on.gif";
} else {
$auctiononoff="off.gif";
}
mysql_select_db($dbname);
eval("\$auctiondisplay = \"".gettemplate('auctiondisplay')."\";");
//PHPAUCTION HACK END
Now, add a template called auctiondisplay:
<table cellSpacing="0" cellPadding="0" width="100%" align="center" bgColor="#1D6AA0" border="0">
<tr>
<td>
<table cellSpacing="1" cellPadding="4" width="100%" border="0">
<tr id="cat">
<td bgColor="#336D95" background="https://vborg.vbsupport.ru/images/catagory_backing.gif" colSpan="2">
<b>Web Auction</b></td>
</tr>
<tr align="middle">
<td vAlign="top" bgColor="#1C5780" width="15">
<img alt src="images/$auctiononoff" border="0" width="15" height="15"></td>
<td align="left" bgColor="#13486D">
<normalfont>
<img alt src="images/forum-icons/gavel.gif" border="0" width="32" height="32"><b>
<a style="color: #000020" href="../phpauction">Forum Web Auction</a> - </b>
<smallfont>lets you buy or sell items in an auction format<br>
<b>Number of active auctions</b>: $num_auctions<br>
<b>Newest Auction</b>: $category: $newest</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
Thats it.