PDA

View Full Version : Question about Thumbnail in Home.



fukuroi
09-01-2009, 08:59 PM
Hi People.

I am trying put a image in each auction in home.

I am not programmer but i try and try, no sucess. :?

line 114: $pict_url = mysql_result($res, $i,"pict_url");

line 128: $TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">"."$pict_url
".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";

Its error -> Warning: Wrong parameter count for mysql_query() in /home/superve1/public_html/leilao/index.php on line 114

Warning: Wrong parameter count for mysql_query() in /home/superve1/public_html/leilao/index.php on line 114

My site is: http://www.superverao.com.br/leilao/index.php

Thanks for support and sorry about my english. :)

renlok
09-01-2009, 09:05 PM
there should be a mysql_query() function just before
line 114: $pict_url = mysql_result($res, $i,"pict_url");

can you say what it says.

fukuroi
09-01-2009, 09:28 PM
$query = "SELECT id, title, starts from ".$DBPrefix."auctions
WHERE
closed='0' AND
suspended=0 AND ";
if($system->SETTINGS['adultonly']=='y' && !isset($_SESSION['PHPAUCTION_LOGGED_IN'])){
$query .= "adultonly='n' AND ";
}
$query .= "starts<=".$NOW."
ORDER BY starts DESC
LIMIT ".$system->SETTINGS['lastitemsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = "#FFFFFF";
$TPL_last_auctions_value = "";
while($i < $num_auction) {
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$date = mysql_result($res,$i,"starts");
$pict_url = mysql_result($res, $i,"pict_url");

$year = substr($date,0,4);
$month = substr($date,4,2);
$day = substr($date,6,2);
$hours = substr($date,8,2);
$minutes = substr($date,10,2);
$seconds = substr($date,12,2);

fukuroi
10-01-2009, 05:59 PM
anyone can help me?/

renlok
10-01-2009, 09:23 PM
hmm ive no idea could you upload the complete file and ill have a look at it

fukuroi
12-01-2009, 12:35 PM
Here the index.php complete.

<?php
/************************************************** *************************
* copyright : (C) 2008 WeBid
* site :http://www.webidsupport.com/
************************************************** *************************/

/************************************************** *************************
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. Although none of the code may be
* sold. If you have been sold this script, get a refund.
************************************************** *************************/

require('includes/config.inc.php');
include $main_path."language/".$language."/categories.inc.php";

#// Run cron according to SETTINGS
if($system->SETTINGS['cron'] == 2) {
include_once "cron.php";
}

$TIME = mktime(date("H")+$system->SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);

function ShowFlags()
{
global $system, $LANGUAGES;
$counter = 0;
foreach($LANGUAGES as $lang => $value)
{
if($counter > 3)
{
print "
";
$counter = 0;
}
print "<a href=\"?lan=$lang\"><IMG vspace=\"2\" hspace=\"2\" SRC=\"".$system->SETTINGS['siteurl']."includes/flags/".$lang.".gif\" BORDER=\"0\" alt=\"$lang\"></A>";
$counter++;
}
}

// prepare categories list for templates/template
// Prepare categories sorting
if($system->SETTINGS['catsorting'] == 'alpha') {
$catsorting = " ORDER BY cat_name ASC";
} else {
$catsorting = " ORDER BY sub_counter DESC";
}
$TPL_categories_value = "";
$query = "select distinct * from ".$DBPrefix."categories
WHERE parent_id = 0
$catsorting";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_cat = mysql_num_rows($res);
$i = 0;
$TPL_categories_value = "<ul>\n";
while($i < $num_cat && $i < $system->SETTINGS['catstoshow']) {
$catlink="";
$cat_id = mysql_result($res,$i,"cat_id");
$cat_name = $category_names[$cat_id];
$sub_count = intval(mysql_result($res, $i, "sub_counter"));
$cat_colour = mysql_result($res, $i, "cat_colour");
$cat_image = mysql_result($res, $i, "cat_image");
$cat_counter = (int)mysql_result($res, $i, "counter" );
if ($sub_count!=0)
$cat_counter = "(".$sub_count.")";
else {
$cat_counter = "";
}
$cat_url = $system->SETTINGS['siteurl']."browse.php?id=$cat_id";
if ( $cat_image != "") {
$catlink = "<A HREF=\"$cat_url\"><IMG SRC=\"$cat_image\" BORDER=0></a>";
}
#// Select the translated category name
$cat_name = $category_names[$cat_id];
$catlink .= "<A HREF=\"$cat_url\">$cat_name</A>"." $cat_counter";
if ( $cat_colour != "") {
$catlink = '<span style="background-color:'.$cat_colour.'">'.$catlink."</span>";
}
$TPL_categories_value .= " ".$catlink."\n";
$i++;
}
$TPL_categories_value .= "[/list]\n";
$TPL_categories_value .= "<A HREF=\"".$system->SETTINGS['siteurl']."browse.php?id=0\">$MSG_277</A>";

// get last created auctions
$query = "SELECT id, title, pict_url, starts from ".$DBPrefix."auctions
WHERE
closed='0' AND
suspended=0 AND ";
if($system->SETTINGS['adultonly']=='y' && !isset($_SESSION['PHPAUCTION_LOGGED_IN'])){
$query .= "adultonly='n' AND ";
}
$query .= "starts<=".$NOW."
ORDER BY starts DESC
LIMIT ".$system->SETTINGS['lastitemsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = "#FFFFFF";
$TPL_last_auctions_value = "";
while($i < $num_auction) {
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$date = mysql_result($res,$i,"starts");
$pict_url = mysql_result($res,0,"pict_url");

$year = substr($date,0,4);
$month = substr($date,4,2);
$day = substr($date,6,2);
$hours = substr($date,8,2);
$minutes = substr($date,10,2);
$seconds = substr($date,12,2);



#// Check bold and highlighted options

$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">"."<img src=\"$pict_url\">
".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}

// get ending soon auctions
$TPL_ending_soon_value = "";
$query = "select ends,id,title from ".$DBPrefix."auctions
WHERE closed='0' AND suspended='0' AND starts <= ".$NOW."
order by ends LIMIT ".$system->SETTINGS['endingsoonnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = "#FFFFFF";
while($i < $num_auction) {
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$ends = mysql_result($res,$i,"ends");
$nowt = $TIME;
$difference = mktime( substr ($ends, 8, 2),
substr ($ends, 10, 2),
substr ($ends, 12, 2),
substr ($ends, 4, 2),
substr ($ends, 6, 2),
substr ($ends, 0, 4))-$nowt;
if ($difference > 0) {
$days_difference = floor($difference / 86400);
$difference = $difference % 86400;
$hours_difference = floor($difference / 3600);
$difference = $difference % 3600;
$minutes_difference = floor($difference / 60);
$seconds_difference = $difference % 60;
$ends_string = sprintf("%d%s %02dh:%02dm:%02ds",$days_difference,$MSG_126, $hours_difference,$minutes_difference,$seconds_dif ference);
} else {
$ends_string = $MSG_911;
}

#// Check bold and highlighted options
$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_ending_soon_value .= "
<p style=\"background-color:$bgcolor;display:block\">".$ends_string."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_ending_soon_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_ending_soon_value .= "";
}

$TPL_ending_soon_value .= stripslashes($title);
if($ISBOLD) {
$TPL_ending_soon_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_ending_soon_value .= "</SPAN>";
}

$TPL_ending_soon_value .= "</A></p>";
$i++;
}

// NOTE: get higher bids
$TPL_maximum_bids = "";
$query = "select auction,max(bid) AS max_bid
FROM ".$DBPrefix."bids b, ".$DBPrefix."auctions a WHERE a.suspended=0 AND a.closed=0 AND a.id=b.auction GROUP BY b.bid,b.auction ORDER BY max_bid desc";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$j = 0;
$bgcolor = "#FFFFFF";
$AU = array();
while($i < $num_auction && $j < $system->SETTINGS['higherbidsnumber']) {
$max_bid = mysql_result($res,$i,"max_bid");
$auction = mysql_result($res,$i,"auction");

//-- Get auction data

$query = "SELECT title,closed,id from ".$DBPrefix."auctions
WHERE id=\"$auction\" AND";
$query .= "'".$NOW."'>=starts";
//print $query;
$result_bid = mysql_query($query);
$system->check_mysql($result_bid, $query, __LINE__, __FILE__);
if(mysql_num_rows($result_bid) > 0) {
$title = mysql_result($result_bid,0,"title");
$closed = mysql_result($result_bid,0,"closed");
$auc_id = mysql_result($result_bid,0,"id");
}

if($closed == "0" && !in_array($auction,$AU)) {
#// Check bold and highlighted options
$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_maximum_bids .="
<p style=\"background-color:$bgcolor;display:block\">".
'<a href="converter.php?AMOUNT='.$max_bid.'" alt="converter" class="new-window">'
.$system->print_money($max_bid)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$auc_id\">";
if($ISHIGHLIGHTED) {
$TPL_maximum_bids .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_maximum_bids .= "";
}
$TPL_maximum_bids .= stripslashes($title);
if($ISBOLD) {
$TPL_maximum_bids .= "";
}
if($ISHIGHLIGHTED) {
$TPL_maximum_bids .= "</SPAN>";
}
$TPL_maximum_bids .= "</A></p>";
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$AU[] = $auction;
$j++;
}
$i++;
}
// Build list of help topics
$query = "SELECT * FROM ".$DBPrefix."faqscategories";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
if(mysql_num_rows($res) > 0) {
$TPL_helptopics = "<ul>";
while($faqscat = mysql_fetch_array($res)) {
$faqscat['category'] = stripslashes(@mysql_result(mysql_query("SELECT category FROM ".$DBPrefix."faqscat_translated WHERE id=".$faqscat['id']." AND lang='".$language."'"),0,"category"));
$TPL_helptopics .= " <a href=\"viewfaqs.php?cat=".$faqscat['id']."\" alt=\"faqs\" class=\"new-window\">".$faqscat['category']."</a>";
}
$TPL_helptopics .= "[/list]";
} else {
$TPL_helptopics = "";
}

//-- Build news list
if($system->SETTINGS['newsbox'] == 1) {
$query = "SELECT title,id,new_date from ".$DBPrefix."news where suspended=0 order by new_date DESC limit ".$system->SETTINGS['newstoshow'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$TPL_news_list = "<ul>";
while($new = mysql_fetch_array($res)) {
$new['title'] = @mysql_result(@mysql_query("SELECT title FROM ".$DBPrefix."news_translated WHERE id=".$new['id']." AND lang='".$language."'"),0,"title");
$new_date= $new['new_date'];
$F_date = FormatDate($new_date);
$TPL_news_list .= " $F_date - <a href=\"viewnew.php?id=".$new['id']."\">".$new['title']."</a>";
}
$TPL_news_list .= "[/list]";
} else {
$TPL_news_list = "";
}

require("header.php");
require(phpa_include("template_index_php.html"));
require('footer.php');
?>

Thanks.

Uldtot
12-01-2009, 04:46 PM
Hope this is what you want to display :)
Renlok, this is also a suggestion to the script :D

the reason for the thumb- removnig is that i cannot craete thumbs in my acutions.. for some reason it wont create them
view it in action at http://www.bornauc.dk (small 50 x50 imaegs next to new auctions :P)


//added by uldtot
$query = "SELECT pict_url from ".$DBPrefix."auctions WHERE id = $id";
$result = mysql_query($query);
if ( !$result ) {
MySQLError($query);
exit;
}

$pict_url_plain = mysql_result ( $result, "pict_url" );
$thumb = "thumb-";
$pict_url_plain_trimmed = str_replace($thumb ,'', $pict_url_plain);

$TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">/uploaded/$id/$pict_url_plain_trimmed".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}

// uldtot editin done

Box Lot
12-01-2009, 05:24 PM
Wouldn't these edits be made in Template/default/home.html?

Either way that was kind of something like I wanted to do as well and just couldn't figure out how to call the item pictures in either/or latest listed or ending soon sections.

I couldn't figure out/find the correct term to correspond with, for example, "{end_soon.DATE}" for its image.

Thought it would be {end_soon.IMAGE} but that didn't seem to work.

Renlok, is there a location not unlike messages.php that shows these types of terms. I know, stop yelling at the screen! Still learning.

renlok
12-01-2009, 05:51 PM
all these variables are set in the php file

for example

$template->assign_vars(array(
'L_ERROR' => (isset($errmsg)) ? $errmsg : '',
'USER' => (isset($_POST['username'])) ? $_POST['username'] : ''
));
will set the variables {L_ERROR} & {USER} in the template file

and for block/loops whatever you want to call ed where in the templae you see something like


...


the variables are defined by something like

$template->assign_block_vars('news', array(
'TITLE' => stripslashes($new['title']),
'ID' => $new['id']
));
these variables are assigned specifically for that loop and cannot be used anywhere else one in the template so to reference them you have to use {news.TITLE} & {news.ID} where news is the name of the loop.

hope that kind of explains how the template variables work



and to add the image variable as its not added already

$template->assign_block_vars('end_soon', array(
'BGCOLOUR' => $bgcolor,
'DATE' => $ends_string,
'ID' => mysql_result($res,$i,'id'),
'TITLE' => mysql_result($res,$i,'title')
));
you must add

,
'IMAGE' => mysql_result($res,$i,'image')
after 'TITLE' => mysql_result($res,$i,'title')

youll also have to image to be pulled from the database as its not being atm

Box Lot
12-01-2009, 05:59 PM
Wow! and gulp! Ha!, certainly explains why my html edits didn't work, DUH!

Thanks for the detailed explanation, that's really great of you.

Reading quickly I think I get the jist and I'll copy it for later detailed reading and experimentation. I'll try to noodle it through for the thumbnails but, regardless, good stuff to learn.

renlok
12-01-2009, 07:28 PM
yeah i look might look a bit complicated but its really simple when you get the hang of it. And at some point i should really write up some sort of documentation of how the templates work.

Box Lot
12-01-2009, 11:29 PM
Certainly would be a bonus but you need to build and, for now, maybe one or two of the experts with all this stuff could continue to post quasi tutorials and I'm sure they will. I've already saved a couple that I can see using for future reference and everyone is responding with nice detail.

Not too complicated for the most part and I'm making a lot of progess on the learning curve but occasionally I hit the wall like this. I understand for the most part how the files work together and where most of the stuff is since you've kept it pretty simple so far which was a large part of the appeal for me.

Not bad for on the job learning though I do have some semi-similar site building experience. This one is much easier.

With you and the growing community here I'm sure I'll be doing the stuff in my sleep by the time you have a robust release (not that they aren't already!).

I'm constantly impressed with your work, attitude and responses.

Box Lot
13-01-2009, 03:53 AM
Hey Uldtot!
Can you tell where to place (replace) these lines in the index? Thanks!



Hope this is what you want to display :)
Renlok, this is also a suggestion to the script :D

the reason for the thumb- removnig is that i cannot craete thumbs in my acutions.. for some reason it wont create them
view it in action at http://www.bornauc.dk (small 50 x50 imaegs next to new auctions :P)


//added by uldtot
$query = "SELECT pict_url from ".$DBPrefix."auctions WHERE id = $id";
$result = mysql_query($query);
if ( !$result ) {
MySQLError($query);
exit;
}

$pict_url_plain = mysql_result ( $result, "pict_url" );
$thumb = "thumb-";
$pict_url_plain_trimmed = str_replace($thumb ,'', $pict_url_plain);

$TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">/uploaded/$id/$pict_url_plain_trimmed".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}

// uldtot editin done

Uldtot
13-01-2009, 11:06 AM
the file index.php

look for these lines:
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}


and you will find where to put it :)
and what to relpace :)

fukuroi
13-01-2009, 03:36 PM
Guys, thanks for help. I like to know that this is good idea for others users.

I try this, but no sucess...


Hope this is what you want to display :)
Renlok, this is also a suggestion to the script :D

the reason for the thumb- removnig is that i cannot craete thumbs in my acutions.. for some reason it wont create them
view it in action at http://www.bornauc.dk (small 50 x50 imaegs next to new auctions :P)


//added by uldtot
$query = "SELECT pict_url from ".$DBPrefix."auctions WHERE id = $id";
$result = mysql_query($query);
if ( !$result ) {
MySQLError($query);
exit;
}

$pict_url_plain = mysql_result ( $result, "pict_url" );
$thumb = "thumb-";
$pict_url_plain_trimmed = str_replace($thumb ,'', $pict_url_plain);

$TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">/uploaded/$id/$pict_url_plain_trimmed".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)." <A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}

// uldtot editin done

its my index.php

<?php
/************************************************** *************************
* copyright : (C) 2008 WeBid
* site : http://www.webidsupport.com/
************************************************** *************************/

/************************************************** *************************
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. Although none of the code may be
* sold. If you have been sold this script, get a refund.
************************************************** *************************/

require('includes/config.inc.php');
include $main_path."language/".$language."/categories.inc.php";

#// Run cron according to SETTINGS
if($system->SETTINGS['cron'] == 2) {
include_once "cron.php";
}

$TIME = mktime(date("H")+$system->SETTINGS['timecorrection'],date("i"),date("s"),date("m"), date("d"),date("Y"));
$NOW = date("YmdHis",$TIME);

function ShowFlags()
{
global $system, $LANGUAGES;
$counter = 0;
foreach($LANGUAGES as $lang => $value)
{
if($counter > 3)
{
print "
";
$counter = 0;
}
print "<a href=\"?lan=$lang\"><IMG vspace=\"2\" hspace=\"2\" SRC=\"".$system->SETTINGS['siteurl']."includes/flags/".$lang.".gif\" BORDER=\"0\" alt=\"$lang\"></A>";
$counter++;
}
}

// prepare categories list for templates/template
// Prepare categories sorting
if($system->SETTINGS['catsorting'] == 'alpha') {
$catsorting = " ORDER BY cat_name ASC";
} else {
$catsorting = " ORDER BY sub_counter DESC";
}
$TPL_categories_value = "";
$query = "select distinct * from ".$DBPrefix."categories
WHERE parent_id = 0
$catsorting";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_cat = mysql_num_rows($res);
$i = 0;
$TPL_categories_value = "<ul>\n";
while($i < $num_cat && $i < $system->SETTINGS['catstoshow']) {
$catlink="";
$cat_id = mysql_result($res,$i,"cat_id");
$cat_name = $category_names[$cat_id];
$sub_count = intval(mysql_result($res, $i, "sub_counter"));
$cat_colour = mysql_result($res, $i, "cat_colour");
$cat_image = mysql_result($res, $i, "cat_image");
$cat_counter = (int)mysql_result($res, $i, "counter" );
if ($sub_count!=0)
$cat_counter = "(".$sub_count.")";
else {
$cat_counter = "";
}
$cat_url = $system->SETTINGS['siteurl']."browse.php?id=$cat_id";
if ( $cat_image != "") {
$catlink = "<A HREF=\"$cat_url\"><IMG SRC=\"$cat_image\" BORDER=0></a>";
}
#// Select the translated category name
$cat_name = $category_names[$cat_id];
$catlink .= "<A HREF=\"$cat_url\">$cat_name</A>"." $cat_counter";
if ( $cat_colour != "") {
$catlink = '<span style="background-color:'.$cat_colour.'">'.$catlink."</span>";
}
$TPL_categories_value .= " ".$catlink."\n";
$i++;
}
$TPL_categories_value .= "[/list]\n";
$TPL_categories_value .= "<A HREF=\"".$system->SETTINGS['siteurl']."browse.php?id=0\">$MSG_277</A>";

// get last created auctions
$query = "SELECT id, title, starts from ".$DBPrefix."auctions
WHERE
closed='0' AND
suspended=0 AND ";
if($system->SETTINGS['adultonly']=='y' && !isset($_SESSION['PHPAUCTION_LOGGED_IN'])){
$query .= "adultonly='n' AND ";
}
$query .= "starts<=".$NOW."
ORDER BY starts DESC
LIMIT ".$system->SETTINGS['lastitemsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = "#FFFFFF";
$TPL_last_auctions_value = "";
while($i < $num_auction) {
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$date = mysql_result($res,$i,"starts");

$year = substr($date,0,4);
$month = substr($date,4,2);
$day = substr($date,6,2);
$hours = substr($date,8,2);
$minutes = substr($date,10,2);
$seconds = substr($date,12,2);

$query = "SELECT pict_url from ".$DBPrefix."auctions WHERE id = $id";
$result = mysql_query($query);
if ( !$result ) {
MySQLError($query);
exit;
}

$pict_url_plain = mysql_result ( $result, "pict_url" );
$thumb = "thumb-";
$pict_url_plain_trimmed = str_replace($thumb ,'', $pict_url_plain);



#// Check bold and highlighted options

$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_last_auctions_value .="<p style=\"background-color:$bgcolor;display:block\">/uploaded/$id/$pict_url_plain_trimmed".ArrangeDateNoCorrection($day,$month,$year,$hours, $minutes)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
$TPL_last_auctions_value .= stripslashes($title);
if($ISBOLD) {
$TPL_last_auctions_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_last_auctions_value .= "</SPAN>";
}
$TPL_last_auctions_value .= "</A></p>";
$i++;
}

// get ending soon auctions
$TPL_ending_soon_value = "";
$query = "select ends,id,title from ".$DBPrefix."auctions
WHERE closed='0' AND suspended='0' AND starts <= ".$NOW."
order by ends LIMIT ".$system->SETTINGS['endingsoonnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = "#FFFFFF";
while($i < $num_auction) {
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$ends = mysql_result($res,$i,"ends");
$nowt = $TIME;
$difference = mktime( substr ($ends, 8, 2),
substr ($ends, 10, 2),
substr ($ends, 12, 2),
substr ($ends, 4, 2),
substr ($ends, 6, 2),
substr ($ends, 0, 4))-$nowt;
if ($difference > 0) {
$days_difference = floor($difference / 86400);
$difference = $difference % 86400;
$hours_difference = floor($difference / 3600);
$difference = $difference % 3600;
$minutes_difference = floor($difference / 60);
$seconds_difference = $difference % 60;
$ends_string = sprintf("%d%s %02dh:%02dm:%02ds",$days_difference,$MSG_126, $hours_difference,$minutes_difference,$seconds_dif ference);
} else {
$ends_string = $MSG_911;
}

#// Check bold and highlighted options
$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_ending_soon_value .= "
<p style=\"background-color:$bgcolor;display:block\">".$ends_string."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$id\">";
if($ISHIGHLIGHTED) {
$TPL_ending_soon_value .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_ending_soon_value .= "";
}

$TPL_ending_soon_value .= stripslashes($title);
if($ISBOLD) {
$TPL_ending_soon_value .= "";
}
if($ISHIGHLIGHTED) {
$TPL_ending_soon_value .= "</SPAN>";
}

$TPL_ending_soon_value .= "</A></p>";
$i++;
}

// NOTE: get higher bids
$TPL_maximum_bids = "";
$query = "select auction,max(bid) AS max_bid
FROM ".$DBPrefix."bids b, ".$DBPrefix."auctions a WHERE a.suspended=0 AND a.closed=0 AND a.id=b.auction GROUP BY b.bid,b.auction ORDER BY max_bid desc";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$j = 0;
$bgcolor = "#FFFFFF";
$AU = array();
while($i < $num_auction && $j < $system->SETTINGS['higherbidsnumber']) {
$max_bid = mysql_result($res,$i,"max_bid");
$auction = mysql_result($res,$i,"auction");

//-- Get auction data

$query = "SELECT title,closed,id from ".$DBPrefix."auctions
WHERE id=\"$auction\" AND";
$query .= "'".$NOW."'>=starts";
//print $query;
$result_bid = mysql_query($query);
$system->check_mysql($result_bid, $query, __LINE__, __FILE__);
if(mysql_num_rows($result_bid) > 0) {
$title = mysql_result($result_bid,0,"title");
$closed = mysql_result($result_bid,0,"closed");
$auc_id = mysql_result($result_bid,0,"id");
}

if($closed == "0" && !in_array($auction,$AU)) {
#// Check bold and highlighted options
$ISBOLD = FALSE;
$ISHIGHLIGHTED = FALSE;

$TPL_maximum_bids .="
<p style=\"background-color:$bgcolor;display:block\">".
'<a href="converter.php?AMOUNT='.$max_bid.'" alt="converter" class="new-window">'
.$system->print_money($max_bid)."<A HREF=\"".$system->SETTINGS['siteurl']."item.php?id=$auc_id\">";
if($ISHIGHLIGHTED) {
$TPL_maximum_bids .= "<SPAN CLASS=hg>";
}
if($ISBOLD) {
$TPL_maximum_bids .= "";
}
$TPL_maximum_bids .= stripslashes($title);
if($ISBOLD) {
$TPL_maximum_bids .= "";
}
if($ISHIGHLIGHTED) {
$TPL_maximum_bids .= "</SPAN>";
}
$TPL_maximum_bids .= "</A></p>";
if($bgcolor == "#FFFFFF") {
$bgcolor = $FONTCOLOR[$system->SETTINGS['headercolor']];
} else {
$bgcolor = "#FFFFFF";
}
$AU[] = $auction;
$j++;
}
$i++;
}
// Build list of help topics
$query = "SELECT * FROM ".$DBPrefix."faqscategories";
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
if(mysql_num_rows($res) > 0) {
$TPL_helptopics = "<ul>";
while($faqscat = mysql_fetch_array($res)) {
$faqscat['category'] = stripslashes(@mysql_result(mysql_query("SELECT category FROM ".$DBPrefix."faqscat_translated WHERE id=".$faqscat['id']." AND lang='".$language."'"),0,"category"));
$TPL_helptopics .= " <a href=\"viewfaqs.php?cat=".$faqscat['id']."\" alt=\"faqs\" class=\"new-window\">".$faqscat['category']."</a>";
}
$TPL_helptopics .= "[/list]";
} else {
$TPL_helptopics = "";
}

//-- Build news list
if($system->SETTINGS['newsbox'] == 1) {
$query = "SELECT title,id,new_date from ".$DBPrefix."news where suspended=0 order by new_date DESC limit ".$system->SETTINGS['newstoshow'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$TPL_news_list = "<ul>";
while($new = mysql_fetch_array($res)) {
$new['title'] = @mysql_result(@mysql_query("SELECT title FROM ".$DBPrefix."news_translated WHERE id=".$new['id']." AND lang='".$language."'"),0,"title");
$new_date= $new['new_date'];
$F_date = FormatDate($new_date);
$TPL_news_list .= " $F_date - <a href=\"viewnew.php?id=".$new['id']."\">".$new['title']."</a>";
}
$TPL_news_list .= "[/list]";
} else {
$TPL_news_list = "";
}

require("header.php");
require(phpa_include("template_index_php.html"));
require('footer.php');
?>

my site: www.superverao.com.br/leilao (http://www.superverao.com.br/leilao).

Thanks :!:

Uldtot
13-01-2009, 03:40 PM
Hmm the change do work.. i must have wrote someting worng in the code..

/uploaded/$id/$pict_url_plain_trimmed

change to

/uploaded/$id/$pict_url_plain_trimmed

if this still dont work

try this
uploaded/$id/$pict_url_plain_trimmed



i can see on your site it des try to display the image, but i cannot find it. guessing its because of the /

Box Lot
13-01-2009, 06:08 PM
Maybe a version issue, I'm on 0.7.2 RC9 and I don't have those lines in my index.php! ?

My Index IS different from fukuroi's and I certainly explains why I couldn't figure out where to put the code. Guess I'll have to study Renlok's mini tutorial instead.

Thanks for the pointer anyway!

Uldtot
13-01-2009, 06:28 PM
maybe its the wrong index.php you looking at :D

includes/index.php

Box Lot
13-01-2009, 07:17 PM
Uhhhhhh, was looking in /index.php.

However, here's my includes/index.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>
</html>

Box Lot
14-01-2009, 01:22 AM
Every try I make with uldtot stuff I get:
Parse error: syntax error, unexpected '}' line 141


Trying Renloks explanation , I've changed/added:

$template->assign_block_vars('auc_last', array(
'BGCOLOUR' => $bgcolor,
'DATE' => ArrangeDateNoCorrection($day,$month,$year,$hours,$ minutes),
'ID' => mysql_result($res,$i,'id'),
'TITLE' => mysql_result($res,$i,'title'),
'IMAGE' => mysql_result($res,$i,'image')
in /index.php

then edited /themes/default/home.html to:


<p style="background-color:{auc_last.BGCOLOUR};display:block;">{auc_last.TITLE} {auc_last.IMAGE} ({SITEURL}item.php?id={auc_last.ID})</p>


Doesn't work though I can get, for example, two TITLEs to show up next to each other so the edit is working I must just be calling out something wrong. If it matters, only one of the items currently on the recent list has a picture uploaded.

Yeah, looking at source the <href...comes out fine and point to the auction but nothing to latch on to, just goes to </a>.

jbilliau
14-01-2009, 02:27 AM
The problem is you can't use Uldtot's code in newer versions.... Renlok rewrote most of the code. $TPL_last_auctions_value for example doesn't even exist anymore as a variable. I think it may be $auc_last, but havn't looked thoroughly...
And no line 141 you won't see the same code cuz again, rewritten code...

I've fooled with it a little bit and got the graphics to echo back...just havnt messed with getting them to display. Maybe better to wait and see if Renlok justs throws that bit of code in as a default for the package....

:geek:

Box Lot
14-01-2009, 02:39 AM
Glad it wasn't me with the index stuff and thought as much which I why I specified my version.

Yeah, I have the feeling he might add this and using it mostly (though I want it NOW!) as a learning experience for calling the variables and just being able to "see" the page as a flow.

Barring the addition, please keep in touch if you get yours working and I'll continue the on the job training as well.

Thanks for the reply.

fukuroi
14-01-2009, 10:15 AM
Well almost there, lack little.

Here, the change:


/uploaded/$id/$pict_url_plain_trimmed

to


uploaded/$id/$pict_url_plain_trimmed

but appear only 1 image, hehehe :lol: .

This way is correct but not 100% yet, on the way :).

Thanks e go to continue this.

Uldtot
14-01-2009, 11:21 AM
the easyest way would be if renlok craeted this in the script.
because of code changes (like jbilliau said)

Box Lot
14-01-2009, 06:36 PM
I put it in the suggestions forum, I think we need to let Renlok continue with his plan and pace as best we can (despite him rescuing all of us more than once!) and especially since here people are on different versions and there are bugs and issues with current features yet to work out.

It's not officially on the to do list so the suggestion forum seems right to me.

Doesn't mean we can't continue to work on it here however! Remember to note your version with this kind of stuff since changes are now fast and furious.

Uldtot
14-01-2009, 07:18 PM
when 0.7.2 is released i will work on my theme and try to make this work again ;)

Box Lot
14-01-2009, 10:15 PM
Yeah, me too. Definitely doable so we can all rest assured that one way or another the option will become available soon.

Small group so far but everyone working together really well and helping when they can. Imagine when the community grows! Can't wait until more :ugeek: s show up and starting posting cool Mods.

Box Lot
17-01-2009, 12:03 AM
Ok, I got the thumbnails working on my home page. Thanks for the just right instructions Renlok, they made me do just enough work on my own to teach me what's up.

Next thing I need to figure out (hint, hint) is how to make and if/then so items without pictures either have the similar width/height blank or the no picture loaded image.

Right now the columns are out of line since those without pictures just show the href link Red lines (thin).

Still cool.

clivester
17-01-2009, 05:13 PM
Hi Box Lot:
Any chance you could post a summary of your code revisions? Would be a useful resource for others since its hard to follow the thread and figure exactly what was done ;)

Box Lot
17-01-2009, 08:04 PM
Yeah, I thought about that and usually like to do that as a rule with fixes (AND EVERYONE ELSE SHOULD TOO!) but I was afraid my clumsy work might not be taken well by the :geek: s and you ( :ugeek: ). Also wasn't a fix per. se. .

I'm not sure things are in their logical place inside the code since I don't do no book readin'. I don't need no stinkin' books!
Comments on cleanliness always welcome.

Bear with me, I also moved pieces of information in my views so the picture is always at the left side of the center box. Those can easily be moved or left where they are if people have layout preferences. I also removed seconds from time display.

I'll post ending items for illustration, happy to post the others but basically the same.

/index.php
on or about line 118:

// get ending soon auctions
$query = "select ends, id, title, pict_url, current_bid from ".$DBPrefix."auctions
WHERE closed='0' AND suspended='0' AND starts <= ".$NOW."
order by ends LIMIT ".$system->SETTINGS['endingsoonnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);
$num_auction = mysql_num_rows($res);

$i = 0;
$bgcolor = '#FFFFFF';
while($i < $num_auction) {
if($bgcolor == '#FFFFFF') {
$bgcolor = '#FFFEEE';
} else {
$bgcolor = '#FFFFFF';
}
$title = mysql_result($res,$i,"title");
$id = mysql_result($res,$i,"id");
$pict_url = mysql_result($res,$i,"pict_url");
$current_bid = mysql_result($res,$i,"current_bid");
$ends = mysql_result($res,$i,"ends");
$nowt = $TIME;
$difference = mktime(substr ($ends, 8, 2),
substr ($ends, 10, 2),
substr ($ends, 12, 2),
substr ($ends, 4, 2),
substr ($ends, 6, 2),
substr ($ends, 0, 4))-$nowt;
if ($difference > 0) {
$days_difference = floor($difference / 86400);
$difference = $difference % 86400;
$hours_difference = floor($difference / 3600);
$difference = $difference % 3600;
$minutes_difference = floor($difference / 60);
$seconds_difference = $difference % 60;
$ends_string = sprintf("%d%s %02dh:%02dm:%02ds",$days_difference,$MSG['126'], $hours_difference,$minutes_difference,$seconds_dif ference);
$ends_stringabr = sprintf("%d%s %02dh:%02dm",$days_difference,$MSG['126'], $hours_difference,$minutes_difference);
} else {
$ends_string = $MSG['911'];
}
$template->assign_block_vars('end_soon', array(
'BGCOLOUR' => $bgcolor,
'DATE' => $ends_string,
'DATEABR' => $ends_stringabr,
'ID' => mysql_result($res,$i,'id'),
'TITLE' => mysql_result($res,$i,'title'),
'IMAGE' => mysql_result($res,$i,'pict_url'),
'HBID' => $system->print_money($current_bid),
));
$i++;
}
$end_soon = ($i > 0) ? true : false;


/themes/default/home.html
on or about line 66:


<tr>
<td class="titTable4">{L_280}</td>
</tr>
<tr>
<td class="table2">

<p style="background-color:{end_soon.BGCOLOUR};display:block;"> {SITEURL}uploaded/{end_soon.ID}/{end_soon.IMAGE} ({SITEURL}item.php?id={end_soon.ID}) {end_soon.TITLE} ({SITEURL}item.php?id={end_soon.ID}) - {end_soon.DATEABR}, {end_soon.HBID}</p>

</td>
</tr>


P.S.
By the way, JB is right in a following post and please keep in mind that I do not recommend others follow my changes here which were more for my own learning process and may cause you confusion and problems when later releases come out with changes. Use at your own discretion

jbilliau
17-01-2009, 11:25 PM
NO code hacks! ;) Renlok will implement this bad boy sometime soon... :oops: :?

Box Lot
18-01-2009, 01:17 AM
Yeah, but asked for and given. I don't necessarily recommend it for most.

I'm sure there are a few things I'll need to revert back to default but I'm enjoying customizing and it is a great learning tool for me. Simple file compares have been working well for me and we'll get the heads up if/when this happens. Certainly it is likely planned at least for the featured auctions.

Good example is my taking seconds off time and Renlok did that for RC12 so anyone braving my lame hacks should note that my previous time edit wont work and no time will show up until you revert the home.html (in this case the ending ones) back to

{end_soon.DATE}
versus

{end_soon.DATEABR}

References to DATEABR in index can be removed.

Having said all that, the process taught me a good deal about how things are pulled and formatted.

If anyone decides to use my edits and gets lost they can always reload the package default which you should always keep handy.

Sorry JB, we ALL can't be :geek: s!! :mrgreen:

jbilliau
18-01-2009, 01:37 AM
haha, thats cool man... you implement the mods and mess with the coding, I'll do the testing and come up with the neat ideas. lol

Box Lot
18-01-2009, 01:46 AM
Whaaa!?, you mean I had a choice? Damn!

5202213
16-02-2009, 05:26 AM
I have the newest version of WeBid. Is there now a way to have thumbnails show on the main index page next to newly listed auctions, auctions ending soon and auctions with the highest bids? I tried the coding in the first page of replies, provided by the admin. I don't understand this part: "youll also have to image to be pulled from the database as its not being atm"

Box Lot
16-02-2009, 07:31 AM
I'm still using the edits I posted after getting hints and direction from Renlok. They're on page 3 of this posting. Use at your own risk and always keep a clean backup of the default just in case.

Also, note the change in name of the date field that I post a couple of posts after the edits to clean things up and make it work.

The /index.php edits take care of what Renlok was saying and gets and adds the information used for the images in themes/yourtheme/home.html.

Duplicate the /index.php edits I noted for the ending soon section to where the new and high bid auction sections are.

Then duplicate the edits in themes/yourtheme/home.html for those sections in that file.

5202213
17-02-2009, 05:10 AM
I did everything you said, exactly as you said to,and it didn't work for me. I don't know what the problem is. :cry:

renlok
20-02-2009, 11:39 PM
ok i keep forgetting about this, so im working on it now.

Uldtot
20-02-2009, 11:40 PM
ok i keep forgetting about this, so im working on it now.
YEA NICE!! :D


im tired :D lol

Netuddki
06-03-2009, 04:11 PM
I use this hack and it's nice, but how can I make it so, that the auctions get listed next to eachother not below eachother?

I want 3 pictures in the same row and if there are 3, next row opens.

I tried everything with display:inline and and so, but nothing. It's just gets messed up...

tamarillo61
07-03-2009, 08:40 AM
Same here, Ive tried br tags after each line to push the text down after using <p align="left"> to wrap the text around the image, but it still ends up a mess. I'm thinking it may be easier to define the table in the css file and leave the home.html page alone.

In the themes section someone has managed to do this with a new theme, but even looking at that i get lost.

tamarillo61
07-03-2009, 09:41 AM
Ok, have edited the css file and the home.html page but I can't stop the bottom box that holds the item descrition from getting larger if the descrition is longer.

my site http://www.giftsandmore.co.nz for example of thumbnails in homepage

Netuddki
09-03-2009, 01:44 PM
Ok, I managed it.

Open themes/default/home.html (or your theme)

Find


<p style="background-color:{auc_last.BGCOLOUR};display:block;">{auc_last.DATE} {auc_last.TITLE} ({SITEURL}item.php?id={auc_last.ID})</p>


Change to



<div class="eachProductBox">

{SITEURL}/uploaded/{auc_last.ID}/{auc_last.IMAGE} ({SITEURL}item.php?id={auc_last.ID})
<div class="eachProductBoxInfo">


<center>{auc_last.TITLE} ({SITEURL}item.php?id={auc_last.ID})</center>
</p>
</div>
</div>


Do the same with all of the auction types, which you want to display on home like this.

Open style.css

Add to the end


.eachProductBox {width:120px; border:0px solid #ececec; text-align:center; float:left; margin:0 0px 0px 0px;}
.eachProductBoxInfo {width:120px; height:110; table_layout:fixed; border-top:0px solid #ececec; text-align:left; padding:0px; line-height:1.5em;}

That's all

Of course you can change the style css and the HTML variables after your likeing.

sella2009
10-03-2009, 02:03 AM
I am so confused now :? :? is this code is for featured listing or for thumbnail image only???

Netuddki
10-03-2009, 09:04 AM
It will show you thumbnails in the homepage about the last created, the highest bidded or the soon ending auctions, depending on where you put the code. It will show also links to the auction. I don't exactly know, what you mean with featured auction.

Like tamarillo linked.

Mike
20-05-2009, 12:52 AM
I'd just like to add my comments on the styling mentioned above:


<p style="background-color:{end_soon.BGCOLOUR};display:block; clear: both; float: left;">
<div style="width: 60px; float: left;">
<a href="{SITEURL}item.php?id={end_soon.ID}">
<img src="{SITEURL}uploaded/{end_soon.ID}/{end_soon.IMAGE}" width="60" height="60" border="0">
</a>
</div>
<div style="float: left; text-align: left;">
<a href="{SITEURL}item.php?id={end_soon.ID}">{end_soon.TITLE}</a>
<br />Highest Bid: &euro;{end_soon.BID} - Ending In: {end_soon.DATE}
</div>
</p>

To have items next to each other rather than below, change "clear: both;" to "clear: none;" in the P tag.

I also have a question though, using the method posted here, the value for {end_soon.BID} displays with 4 decimal places (€9.9900).

Does anyone know how I cut it off at 2 decimal places?

Box Lot
20-05-2009, 01:00 AM
For decimal places go to your SQL database and find currency fields in "webid_auctions" you want to edit and change from default of 4 to 2. I think there are about 5 instances or so that need to be edited to get all currency displays the same.

Example:
"minimum bid"

They should be all obvious once you browse "webid_auctions".

Edit:
Here are the money fields:
minimum_bid
shipping_cost
reserve_price
buy_now
increment
current_bid

FYI, best to post a question like this in a new or applicable thread to assure you get responses. Right now many are regularly reviewing all posts but that will change in the future.

chrism
21-05-2009, 12:15 AM
I'd just like to add my comments on the styling mentioned above:

To have items next to each other rather than below, change "clear: both;" to "clear: none;" in the P tag.



Since we're getting into fancy Style tags, i've found a helpful site for a Windows CSS Reference file (CSS 1 only) :

http://www.htmlhelp.com/distribution/css.zip

or there's an online version with CSS 1 & 2
http://www.w3schools.com/css/css_reference.asp

Mike
21-05-2009, 11:17 AM
Box Lot: Genius! Thank you very much :D

Box Lot
21-05-2009, 02:42 PM
Ha!, your easily impressed though, of course, I AM a genius!

Glad I could point you in the right direction.

Box Lot
02-06-2009, 12:11 AM
Anyone know how to resize these thumbnails on the fly for Home page use?

Not dimensions but actual file size since they show up as the original file size (albeit with smaller thumbnail dimensions via html) and depending on users and picture size limitation it might really slow things down.

Meglomaniac
02-06-2009, 05:51 PM
is there a way to have it either ignore auctions shown that have no picture or replate it with the image file no picture availeble like when you browse Categories

fbords
04-06-2009, 07:15 PM
ok i keep forgetting about this, so im working on it now.

So does that mean we can all stop racking our brains on how to get this working for our own individual needs and it will be included in v0.8?

renlok
04-06-2009, 09:30 PM
yes it will be along with all the other new features in 0.8 it will be a massive improvment from 0.7.4

rcooper
08-06-2009, 05:55 AM
Resize Images Using PHP and GD Library

Code demonstrates use of GD library to generate thumbnails.

1. Saves uploaded image specific location;
2. Generates thumbnail image;
3. Saves the generated thumbnail image in JPEG format.

generate_image_thumbnail( ) Function

Following parameters:

source image file path
thumbnail image file path
Upon execution, the function analyzes the source image, calculates destination image dimensions, resizes the image using GD library functions and saves the image to the specified destination in JPEG format.



<?php
define( 'THUMBNAIL_IMAGE_MAX_WIDTH', 150 );
define( 'THUMBNAIL_IMAGE_MAX_HEIGHT', 150 );

function generate_image_thumbnail( $source_image_path, $thumbnail_image_path )
{
list( $source_image_width, $source_image_height, $source_image_type ) = getimagesize( $source_image_path );

switch ( $source_image_type )
{
case IMAGETYPE_GIF:
$source_gd_image = imagecreatefromgif( $source_image_path );
break;

case IMAGETYPE_JPEG:
$source_gd_image = imagecreatefromjpeg( $source_image_path );
break;

case IMAGETYPE_PNG:
$source_gd_image = imagecreatefrompng( $source_image_path );
break;
}

if ( $source_gd_image === false )
{
return false;
}

$thumbnail_image_width = THUMBNAIL_IMAGE_MAX_WIDTH;
$thumbnail_image_height = THUMBNAIL_IMAGE_MAX_HEIGHT;

$source_aspect_ratio = $source_image_width / $source_image_height;
$thumbnail_aspect_ratio = $thumbnail_image_width / $thumbnail_image_height;

if ( $source_image_width <= $thumbnail_image_width && $source_image_height <= $thumbnail_image_height )
{
$thumbnail_image_width = $source_image_width;
$thumbnail_image_height = $source_image_height;
}
elseif ( $thumbnail_aspect_ratio > $source_aspect_ratio )
{
$thumbnail_image_width = ( int ) ( $thumbnail_image_height * $source_aspect_ratio );
}
else
{
$thumbnail_image_height = ( int ) ( $thumbnail_image_width / $source_aspect_ratio );
}

$thumbnail_gd_image = imagecreatetruecolor( $thumbnail_image_width, $thumbnail_image_height );

imagecopyresampled( $thumbnail_gd_image, $source_gd_image, 0, 0, 0, 0, $thumbnail_image_width, $thumbnail_image_height, $source_image_width, $source_image_height );

imagejpeg( $thumbnail_gd_image, $thumbnail_image_path, 90 );

imagedestroy( $thumbnail_gd_image );

return true;
}
?>


Thumbnail Dimensions Calculation

Function maintains the same aspect ratio as the original image; and
Calculates best-fit dimensions for the thumbnail.

To calculate the dimensions for the thumbnail image, the aspect ratios of the original image and "ideal" thumbnail image are calculated. (Note: The aspect ratio of an image is its width divided by its height). The two aspect ratios are then compared. This leads us to the following three possible cases:

Aspect ratios are same


The function uses the ideal width and ideal height for the thumbnail.

Source image is comparatively "taller"


The function uses constrained width and ideal height for the thumbnail.

Source image is comparatively "wider"


The function uses the ideal width and constrained height for the thumbnail.

Resizing the Image
The function uses the imagecopyresampled function available in the GD library. PHP manual provides the following description:

imagecopyresampled() copies a rectangular portion of one image to another image, smoothly interpolating pixel values so that, in particular, reducing the size of an image still retains a great deal of clarity.
Visit the PHP.net to see documentation of the functions used in this example, listed below:

imagecreatefromgif
imagecreatefromjpeg
imagecreatefrompng
imagecreatetruecolor
imagecopyresampled
imagejpeg
imagedestroy

The process_image_upload( ) Function

The following function performs file upload handling. It accepts only one parameter -- the name of the field that contains the file. This function performs necessary error checking and moves the uploaded file around accordingly. It then calls the above mentioned function to generate the thumbnail.



<?php
define( 'UPLOADED_IMAGE_DESTINATION', './images/' );
define( 'THUMBNAIL_IMAGE_DESTINATION', './thumbnails/' );

function process_image_upload( $field )
{
$temp_image_path = $_FILES[ $field ][ 'tmp_name' ];
$temp_image_name = $_FILES[ $field ][ 'name' ];

list( , , $temp_image_type ) = getimagesize( $temp_image_path );

if ( $temp_image_type === NULL )
{
return false;
}

switch ( $temp_image_type )
{
case IMAGETYPE_GIF:
break;

case IMAGETYPE_JPEG:
break;

case IMAGETYPE_PNG:
break;

default:
return false;
}

$uploaded_image_path = UPLOADED_IMAGE_DESTINATION . $temp_image_name;

move_uploaded_file( $temp_image_path, $uploaded_image_path );

$thumbnail_image_path = THUMBNAIL_IMAGE_DESTINATION . preg_replace( '{\\.[^\\.]+$}', '.jpg', $temp_image_name );

$result = generate_image_thumbnail( $uploaded_image_path, $thumbnail_image_path );

return $result
? array( $uploaded_image_path, $thumbnail_image_path )
: false;
}
?>


Putting it all together
To create a complete working example using the functions above, we need to create a page that posts a file to the processing script. Following is the complete code example, along with the file upload form and the actual function call.

The HTML Form
Please note the enctype="multipart/form-data" in the following form. This is very important to assure that your browser actually sends the file.



<form action="image-resize-demo.php" method="post" enctype="multipart/form-data">
Upload an image for processing<br>
<input type="file" name="Image1"><br>
<input type="submit" value="Upload">
</form>


Below is the PHP code that combines the two above-mentioned functions, calls the first one and displays the success or failure message:




<?php
//--------------------------------
// CREATE WATERMARK FUNCTION
//--------------------------------

define( 'THUMBNAIL_IMAGE_MAX_WIDTH', 150 );
define( 'THUMBNAIL_IMAGE_MAX_HEIGHT', 150 );

function generate_image_thumbnail( $source_image_path, $thumbnail_image_path )
{
list( $source_image_width, $source_image_height, $source_image_type ) = getimagesize( $source_image_path );

switch ( $source_image_type )
{
case IMAGETYPE_GIF:
$source_gd_image = imagecreatefromgif( $source_image_path );
break;

case IMAGETYPE_JPEG:
$source_gd_image = imagecreatefromjpeg( $source_image_path );
break;

case IMAGETYPE_PNG:
$source_gd_image = imagecreatefrompng( $source_image_path );
break;
}

if ( $source_gd_image === false )
{
return false;
}

$thumbnail_image_width = THUMBNAIL_IMAGE_MAX_WIDTH;
$thumbnail_image_height = THUMBNAIL_IMAGE_MAX_HEIGHT;

$source_aspect_ratio = $source_image_width / $source_image_height;
$thumbnail_aspect_ratio = $thumbnail_image_width / $thumbnail_image_height;

if ( $source_image_width <= $thumbnail_image_width && $source_image_height <= $thumbnail_image_height )
{
$thumbnail_image_width = $source_image_width;
$thumbnail_image_height = $source_image_height;
}
elseif ( $thumbnail_aspect_ratio > $source_aspect_ratio )
{
$thumbnail_image_width = ( int ) ( $thumbnail_image_height * $source_aspect_ratio );
}
else
{
$thumbnail_image_height = ( int ) ( $thumbnail_image_width / $source_aspect_ratio );
}

$thumbnail_gd_image = imagecreatetruecolor( $thumbnail_image_width, $thumbnail_image_height );

imagecopyresampled( $thumbnail_gd_image, $source_gd_image, 0, 0, 0, 0, $thumbnail_image_width, $thumbnail_image_height, $source_image_width, $source_image_height );

imagejpeg( $thumbnail_gd_image, $thumbnail_image_path, 90 );

imagedestroy( $thumbnail_gd_image );

return true;
}

//--------------------------------
// FILE PROCESSING FUNCTION
//--------------------------------

define( 'UPLOADED_IMAGE_DESTINATION', './images/' );
define( 'THUMBNAIL_IMAGE_DESTINATION', './thumbnails/' );

function process_image_upload( $field )
{
$temp_image_path = $_FILES[ $field ][ 'tmp_name' ];
$temp_image_name = $_FILES[ $field ][ 'name' ];

list( , , $temp_image_type ) = getimagesize( $temp_image_path );

if ( $temp_image_type === NULL )
{
return false;
}

switch ( $temp_image_type )
{
case IMAGETYPE_GIF:
break;

case IMAGETYPE_JPEG:
break;

case IMAGETYPE_PNG:
break;

default:
return false;
}

$uploaded_image_path = UPLOADED_IMAGE_DESTINATION . $temp_image_name;

move_uploaded_file( $temp_image_path, $uploaded_image_path );

$thumbnail_image_path = THUMBNAIL_IMAGE_DESTINATION . preg_replace( '{\\.[^\\.]+$}', '.jpg', $temp_image_name );

$result = generate_image_thumbnail( $uploaded_image_path, $thumbnail_image_path );

return $result
? array( $uploaded_image_path, $thumbnail_image_path )
: false;
}

//--------------------------------
// END OF FUNCTIONS
//--------------------------------

$result = process_image_upload( 'Image1' );

if ( $result === false )
{
echo '<br>An error occurred while processing upload';
}
else
{
echo '<br>Uploaded image saved as ' . $result[ 0 ];
echo '<br>Thumbnail image saved as ' . $result[ 1 ];
}
?>


Limitations of the Script

Supports GIF, JPEG and PNG file handling.

Does not generate unique file names

Does not show any error messages.

Rob

tr3b0r
25-04-2010, 08:58 AM
Ok, I managed it.

Open themes/default/home.html (or your theme)

Find


<p style="background-color:{auc_last.BGCOLOUR};display:block;">{auc_last.DATE} {auc_last.TITLE} ({SITEURL}item.php?id={auc_last.ID})</p>


Change to



<div class="eachProductBox">

{SITEURL}/uploaded/{auc_last.ID}/{auc_last.IMAGE} ({SITEURL}item.php?id={auc_last.ID})
<div class="eachProductBoxInfo">


<center>{auc_last.TITLE} ({SITEURL}item.php?id={auc_last.ID})</center>
</p>
</div>
</div>


Do the same with all of the auction types, which you want to display on home like this.

Open style.css

Add to the end


.eachProductBox {width:120px; border:0px solid #ececec; text-align:center; float:left; margin:0 0px 0px 0px;}
.eachProductBoxInfo {width:120px; height:110; table_layout:fixed; border-top:0px solid #ececec; text-align:left; padding:0px; line-height:1.5em;}

That's all

Of course you can change the style css and the HTML variables after your likeing.

Well, i tried this and end up with just the path showing. The Image doesn't get loaded. Btw, not sure if its important or not. But as i could not find home.html, i done the changes to home.tpl.

Any suggestions how to fix my problem?

renlok
25-04-2010, 01:53 PM
why have you used bbcode? that would be your problem you need to use html

tr3b0r
25-04-2010, 10:54 PM
Doo, my fault. Thanks renlok. Guess that must happen after "cross writing" a phpbb forum and the webid site. Ok, and the matter that i just copy pasted heh. :p

tr3b0r
26-04-2010, 08:29 AM
I have to say i can't fix that by myself as i'm quit new into this html stuff. I tried but i must abandon. Maybe you would be so kind, push me into the right direction and show me how to load the image with html?

Thanks in advance

renlok
26-04-2010, 09:28 AM
i would be

<img src="http://www.mysite.com/imagelocation/image.jpg" >
just replace the http://www.mysite.com/imagelocation/image.jpg with the location of your image
:)

tr3b0r
26-04-2010, 10:47 AM
hmn, thats how i did it allready but i end up with neither a description nor an image shown.

home.tpl

<!-- IF B_AUC_LAST -->
<tr>
<td class="titTable4">{L_278}</td>
</tr>
<tr>
<td class="table2">
<!-- BEGIN auc_last -->
<div class="eachProductBox">
<a href="{SITEURL}item.php?id={auc_last.ID}"><img src="{SITEURL}/uploaded/{auc_last.ID}/{auc_last.IMAGE}" >
<div class="eachProductBoxInfo">
<center><a href="{siteurl}item.php?id={auc_last.ID}"></center></p>
</div>
</div>
<!-- END auc_last -->
</td>
</tr>
<!-- ENDIF -->

style.css

.eachProductBox {width:120px; border:0px solid #ececec; text-align:center; float:left; margin:0 0px 0px 0px;}
.eachProductBoxInfo {width:120px; height:110; table_layout:fixed; border-top:0px solid #ececec; text-align:left; padding:0px; line-height:1.5em;}

renlok
26-04-2010, 03:28 PM
try this you missed out some things i would hope this would work

<!-- IF B_AUC_LAST -->
<tr>
<td class="titTable4">{L_278}</td>
</tr>
<tr>
<td class="table2">
<!-- BEGIN auc_last -->
<div class="eachProductBox">
<a href="{SITEURL}item.php?id={auc_last.ID}"><img src="{SITEURL}/uploaded/{auc_last.ID}/{auc_last.IMAGE}" ></a>
<div class="eachProductBoxInfo">
<center><a href="{siteurl}item.php?id={auc_last.ID}">{auc_last.TITLE}</a></center></p>
</div>
</div>
<!-- END auc_last -->
</td>
</tr>
<!-- ENDIF -->

also have you added the php code described on the first page of this thread?

tr3b0r
26-04-2010, 05:26 PM
Description is now shown, but not the image :/

home.tpl ( i just remove a / infront of "uploaded" as the path was wrong, didn't worked either ) :

<!-- IF B_AUC_LAST -->
<tr>
<td class="titTable4">{L_278}</td>
</tr>
<tr>
<td class="table2">
<!-- BEGIN auc_last -->
<div class="eachProductBox">
<a href="{SITEURL}item.php?id={auc_last.ID}"><img src="{SITEURL}uploaded/{auc_last.ID}/{auc_last.IMAGE}" ></a>
<div class="eachProductBoxInfo">
<center><a href="{siteurl}item.php?id={auc_last.ID}">{auc_last.TITLE}</a></center></p>
</div>
</div>
<!-- END auc_last -->
</td>
</tr>
<!-- ENDIF -->

index.php ( image variable added ) :

// get last created auctions
$query = "SELECT id, title, pict_url, starts from " . $DBPrefix . "auctions
WHERE closed = 0 AND suspended = 0
AND starts <= " . $NOW . "
ORDER BY starts DESC
LIMIT " . $system->SETTINGS['lastitemsnumber'];
$res = mysql_query($query);
$system->check_mysql($res, $query, __LINE__, __FILE__);

$i = 0;
$bgcolor = '#FFFFFF';
while ($row = mysql_fetch_assoc($res))
{
$template->assign_block_vars('auc_last', array(
'BGCOLOUR' => ($bgcolor == '#FFFFFF') ? '#FFFEEE' : '#FFFFFF',
'DATE' => ArrangeDateNoCorrection($row['starts'] + $system->tdiff),
'ID' => $row['id'],
'TITLE' => $row['title'],
'IMAGE' => mysql_result($res,$i,'image')
));
$i++;
}

$auc_last = ($i > 0) ? true : false;

Ain't possible to add the mysql get method described @ the first sites without rendering the site blank. Found the notes that this method ain't working anymore.

I also tried to use the getthumb string you used somewhere else in your code. Ended up with an image above the descriptions: "No Image available" or "Not an image path"

Partial Sourcecode of the rendered site:

<td class="titTable4">Die zuletzt eingestellten Auktionen</td>
</tr>
<tr>
<td class="table2">
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=32"><img src="http://mywebserver.com/WeBid/uploaded/32/"></a>
<div class="eachProductBoxInfo">

<center><a href="item.php?id=32">USA</a></center>
</div>
</div>
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=31"><img src="http://mywebserver.com/WeBid/uploaded/31/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=31">Uruguay</a></center>
</div>

</div>
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=30"><img src="http://mywebserver.com/WeBid/uploaded/30/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=30">Südafrika</a></center>
</div>
</div>
<div class="eachProductBox">

<a href="http://mywebserver.com/WeBid/item.php?id=29"><img src="http://mywebserver.com/WeBid/uploaded/29/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=29">Spanien</a></center>
</div>
</div>
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=28"><img src="http://mywebserver.com/WeBid/uploaded/28/"></a>
<div class="eachProductBoxInfo">

<center><a href="item.php?id=28">Slowenien</a></center>
</div>
</div>
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=27"><img src="http://mywebserver.com/WeBid/uploaded/27/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=27">Slowakei</a></center>
</div>

</div>
<div class="eachProductBox">
<a href="http://mywebserver.com/WeBid/item.php?id=26"><img src="http://mywebserver.com/WeBid/uploaded/26/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=26">Serbien</a></center>
</div>
</div>
<div class="eachProductBox">

<a href="http://mywebserver.com/WeBid/item.php?id=25"><img src="http://mywebserver.com/WeBid/uploaded/25/"></a>
<div class="eachProductBoxInfo">
<center><a href="item.php?id=25">Schweiz</a></center>
</div>
</div>
</td>
</tr>


</tbody></table>

tr3b0r
26-04-2010, 05:48 PM
After i checked another time, i found the mistake in the indexphp, changed


'IMAGE' => mysql_result($res,$i,'image')

to


'IMAGE' => mysql_result($res,$i,"pict_url")

and viola, it werked :) Thank you for your kind assistance