I am runnig PHPBB3 forums and webid on very same server. Below is a description of central block plugin for Board3portal. To achive goal you need to run PHPBB3 and WeBid databases under very same credentials and on very same server as well. After all what you will gain will look like this:
Requirements:
PHPBB3
Board3Portal mod for PHPBB3
Files to be modified in your forums install:
root/portal.php
root/styles/prosilver/template/portal/portal_center.html
root/language/en/common.php
Files to be copied (while I can not upload files, complete code is included in this thread):
root/portal/block/webid.php
root/styles/prosilver/template/portal/block/webid.html
just extract belowe archive to your root folder
Open root/portal.php and find:
Code: Select all
$load_center = true;
// Always load center column html-file in portal
$template->assign_var('S_CENTER_COLUMN', true);
Code: Select all
include($phpbb_root_path . 'portal/block/webid.' . $phpEx); // add central webid block
Code: Select all
<!-- IF S_DISPLAY_POLL -->
<!-- INCLUDE portal/block/poll.html -->
<!-- ENDIF -->
Code: Select all
<!-- INCLUDE portal/block/webid.html -->
Code: Select all
?>
Code: Select all
// BEGIN board3portal center WEBID block
$lang = array_merge($lang, array(
'BUY_NOW' => 'B uy now: ',
'AUCTION' => 'Auction: ',
'WEBID_TITLE' => 'WeBid auctions',
'WEBID_COUNTER' => 'auctions: ',
'ENDS' => 'Ends: ',
'ENDS_1' => 'Ended',
'ENDS_IN' => ' days '
));
// END board3portal center WEBID block
While I can not upload files, bolow you will find content of those:
root/portal/block/webid.php
Code: Select all
<?php
/**
*
* @package - Board3portal
* @version $Id: articles.php 001 2011-04-25 10:50:43Z t90 $
* @copyright (c) t90 (busomania.pl)
* @based on: phpBB3 Portal by Sevdin Filiz, www.phpbb3portal.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
if (!defined('IN_PHPBB') || !defined('IN_PORTAL'))
{
exit;
}
$yourWebidDatabase = "webid"; // change appropriate to your WeBid database name
// getting some webid settings
$settingsSql = "SELECT `siteurl` , `moneydecimals` , `currency` FROM `."$yourWebidDatabase".`.`webid_settings`";
$settingsResult = mysql_query($settingsSql);
$settingsRow = mysql_fetch_assoc($settingsResult);
// getting active auctions in random order
$sql = "SELECT * FROM `."$yourWebidDatabase".`.`webid_auctions` WHERE closed = 0 AND suspended = 0 AND starts <= " . time() . " ORDER BY RAND()";
$result = mysql_query($sql);
$num=mysql_num_rows($result); // this is needed to show to user how many active auctions there is
$i = 0;
while($row = mysql_fetch_assoc($result) AND $i < 4) // fetching results to associative array and limiting display to 4 auctions
{
$ends = $row['ends'];
$difference = $ends - time();
$high_bid = ($row['num_bids'] == 0) ? $row['minimum_bid'] : $row['current_bid'];
$high_bid = ($row['bn_only'] == 'y') ? $row['buy_now'] : $high_bid;
$template->assign_block_vars('auctions', array(
'ID' => $row['id'],
'IMAGE' => (!empty($row['pict_url'])) ? $settingsRow['siteurl'].'uploaded/'. $row['id'] . '/' . $row['pict_url'] : $settingsRow['siteurl'].'images/email_alerts/no-photo.png',
'TITLE' => $row['title'],
'ENDS' => $difference,
'B_BUY_NOW' => ($row['buy_now'] > 0 AND $row['buy_now'] > $row['current_bid']) ? true : false,
'BN_BID' => number_format($row['buy_now'], $settingsRow['moneydecimals'], ',', ' '),
'B_BN_AND_AUC' => ($row['bn_only'] == 'n') ? true : false,
'BID' => number_format($high_bid, $settingsRow['moneydecimals'], ',', ' '),
'BN_WITH_AUC_PRICE' => ($row['current_bid'] > 0 AND $row['num_bids'] > 0) ? number_format($row['current_bid'], $settingsRow['moneydecimals'], ',', ' ') : number_format($row['minimum_bid'], $settingsRow['moneydecimals'], ',', ' ')
));
$i++;
}
$webid = ($i > 0) ? true : false;
// Assign index specific vars
$template->assign_vars(array(
'WEBID' => $webid,
'WEBID_COUNT' => $num,
'CURRENCY' => $settingsRow['currency'],
'WEBID_URL' => $settingsRow['siteurl']
));
?>
Code: Select all
<!-- IF WEBID -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<div class="forumbg">
<div class="inner">
<span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header">
<dl class="icon">
<dt>{L_WEBID_TITLE} <i>({L_WEBID_COUNTER}{WEBID_COUNT})</i></dt>
</dl>
</li>
</ul>
<table class="forumline" width="100%" border="0" cellpadding="0" cellspacing="3">
<tbody><tr>
<!-- BEGIN auctions -->
<td class="bg2" style="width: 25%;" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="1">
<tbody><tr>
<td style="height: 161px;" align="center" valign="top">
<a href="{WEBID_URL}item.php?id={auctions.ID}" target="_blank"><img src="{auctions.IMAGE}" alt="{auctions.TITLE}" title="{auctions.TITLE}" /></a>
<h3><a href="{WEBID_URL}item.php?id={auctions.ID}" title="{auctions.TITLE}" target="_blank" >{auctions.TITLE}</a></h3>
<!-- IF not auctions.B_BUY_NOW -->
<span>{L_AUCTION} <strong>{auctions.BID} <span style="color: red;">{CURRENCY}</span></strong></span><br /><br />
<!-- ENDIF -->
<!-- IF auctions.B_BUY_NOW -->
<span>{L_BUY_NOW} <strong class="bn">{auctions.BN_BID} <span style="color: red;">{CURRENCY}</span></strong></span><br />
<!-- IF not auctions.B_BN_AND_AUC -->
<br />
<!-- ENDIF -->
<!-- IF auctions.B_BN_AND_AUC -->
<span>{L_AUCTION} <strong>{auctions.BN_WITH_AUC_PRICE} <span style="color: red;">{CURRENCY}</span></strong></span><br />
<!-- ENDIF -->
<!-- ENDIF -->
<script type="text/javascript">
$(document).ready(function() {
var currenttime = '{auctions.ENDS}';
function padlength(what)
{
var output=(what.toString().length == 1)? '0' + what : what;
return output;
}
function displaytime()
{
currenttime -= 1;
if (currenttime > 0){
var days = Math.floor((currenttime / 3600) / 24)
var hoursnew = Math.floor((currenttime / 3600) - (days * 24));
var hours = Math.floor(currenttime / 3600);
var mins = Math.floor((currenttime - (hours * 3600)) / 60);
var secs = Math.floor(currenttime - (hours * 3600) - (mins * 60));
var timestring = padlength(days) + '{L_ENDS_IN}' + padlength(hoursnew) + ':' + padlength(mins) + ':' + padlength(secs);
$("#ending_counter_refresh{auctions.ID}").html('<span>{L_ENDS} <strong>' + timestring);
setTimeout(displaytime, 1000);
} else {
$("#ending_counter_refresh{auctions.ID}").html('{ENDS_1}');
}
}
setTimeout(displaytime, 1000);
});
</script>
<div id="ending_counter_refresh{auctions.ID}">{auctions.ENDS}</div></strong></span>
</td>
</tr>
</tbody></table>
</td>
<!-- END auctions -->
</tr>
</tbody></table>
<span class="corners-bottom"><span></span></span>
</div>
</div>
<br style="clear: both;" />
<!-- ENDIF -->