[auction]글도 최신글로 받자.... 정보
일반 [auction]글도 최신글로 받자....본문
저는 박갑성님의 팁택을 참고해서 다음과같이 했습니다. 일단 shop디렉토리에 auction_main.php로 auction.php와 비슷한 구조로 수정을 했습니다.
=========== auction_main.php ==========================================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
define("_DOCTYPE_", "STYLE");
include "./$cfg[shop_dir]/shop.lib.php";
$html_title = "경매";
$base_qstr = "doc=$doc";
?>
<table width=100% border=0 cellpadding=0 cellspacing=1 align=center>
<?
if (!$ssort) {
$ssort = "au_id";
$sorder = "desc";
}
$from = " $cfg[table_auction] a
left join $cfg[table_tbidder] b on (a.au_id = b.au_id) ";
$query = new listQuery();
$query->select(" a.au_id, a.au_subject, a.au_fr_datetime, a.au_to_datetime, a.au_sijakga, a.au_juksiga, a.au_qty ");
$query->from($from);
$query->where($sselect, $stext, $condition);
$query->order($ssort, $sorder);
$query->group(" count(b.bi_id) as cnt, max(b.bi_ipchalga) as hyunjaega, sum(b.bi_qty) as sum_qty ");
$query->limit($cfg[list_rows], $page);
$sql = $query->result();
$result = sql_query($sql);
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$status = get_auction_status($row);
$au_subject = conv_subject($row[au_subject], 100, "…");
// 입찰이 없다면 시작가가 현재가
if ($row[hyunjaega]) {
$hyunjaega = $row[hyunjaega];
} else {
$hyunjaega = $row[au_sijakga];
}
$comment_cnt = "";
$sql2 = " select count(*) from $cfg[table_tcomment]
where au_id = '$row[au_id]' ";
$row2 = sql_fetch($sql2);
if ($row2[0]) {
$comment_cnt = " <span style='font-size:8pt;'>($row2[0])</span>";
}
$list = ($i%3);
echo "<tr>";
echo "<td width=100 rowspan=6 valign=top><table width=99 border=0 cellpadding=0 cellspacing=0>";
echo "<tr><td width=99 height=24 background=images/pro_top.gif align=center valign=bottom>";
echo "<b><font color=red>$status</font></b></td></tr>";
echo "<tr><td width=99 height=74 align=center valign=top background=images/pro_main.gif>";
echo "<a href='./?doc=$cfg[shop_dir]/auctiondetail.php&au_id=$row[au_id]'>
<img src='./$cfg[shop_dir]/img/auction/$row[au_id]_0' width=80 height=65 border=0></a> <----요부분이 이미지 불러오는 부분입니다. 전 첫번째 이미지를 불러오는 것을 기본으로 하여 $row[au_id]_0 로 하였습니다. 그러면 경매번호를 기준으로 0~4까지중에서 0번이미지를 불러옵니다. 사이즈는 메인에 따라서 정하시면 됩니다. 물론 자동으로 조절하게끔 하면 되지만 아직 실력이 미진하여...전 사이즈를 정했습니다. 참고하세요... ---->
</td></tr>
</table></td>";
echo "<tr><td align=center>[<font color=blue><b>$au_subject</b></font>]{$comment_cnt}</td></tr>";
echo "<tr><td>마감일 : $row[au_to_datetime] (".get_yoil($row[au_to_datetime]).")</td></tr>";
echo "<tr><td>현재가 : ".nf($hyunjaega)." 원 </td></tr>";
?>
<script language="JavaScript">
<?
$tgap = strtotime($row[au_to_datetime]) - time();
$tday = (int)($tgap / 86400);
$thour = (int)(($tgap - ($tday * 86400)) / 3600);
$tmin = (int)(($tgap - ($tday * 86400 + $thour * 3600)) / 60);
$tsec = (int)($tgap - ($tday * 86400 + $thour * 3600 + $tmin * 60));
?>
var tday = <?=$tday?>;
var thour = <?=$thour?>;
var tmin = <?=$tmin?>;
var tsec = <?=$tsec?>;
function runtimer()
{
var s = "";
if (tday > 0)
s += tday + "일";
if (thour > 0 || s != "") {
if (s != "") s += " ";
s += thour + "시간";
}
if (tmin > 0 || s != "") {
if (s != "") s += " ";
s += tmin + "분";
}
if (tsec > 0 || s != "") {
if (s != "") s += " ";
s += tsec + "초";
}
if (s == "") {
document.fdetail.timer.value = "경매가 마감 되었습니다";
return;
}
document.fdetail.timer.value = s;
tsec--;
if (tsec < 0) {
tsec = 59;
tmin--;
}
if (tmin < 0) {
tmin = 59;
thour--;
}
if (thour < 0) {
thour = 23;
tday--;
}
window.setTimeout('runtimer()',1000);
}
</script>
<tr>
<form name=fdetail><td align=center>
<? if ($is_end) { ?>
<font color=crimson><b>경매 마감</b></font>
<? } else { ?>
<input type="text" name="timer" style='background-color: #ffffff ; border-style:none 0px; color:crimson; font-weight:bold;height:16; font-size:12; border-width: 0px;' readonly>
<script> runtimer(); </script>
<? } ?>
</td>
</form>
<?
echo "<tr><td align=center><a href='./?doc=$cfg[shop_dir]/auctiondetail.php&au_id=$row[au_id]'>
<img src=shop/auction_tender4.gif border=0 width=89 height=21></a> </td></tr>";
echo "</tr>";
}
if ($i == 0) {
echo "<tr><td colspan=9 align=center height=100 class='content contentbg'>자료가 없습니다.</td></tr>";
}
echo "</table>";
?>
==========================================================================================
요로코럼 만든후 메인에서 include방식을 취하였습니다.
즉 메인에서 <? include "./shop/auction_main.php"; ?>
원하는자리에 넣었습니다. 전 별이상없이 뜹니다. 참고하세요....
[이 게시물은 관리자님에 의해 2003-11-25 11:46:16 그샵팁텍(으)로 부터 이동됨]
=========== auction_main.php ==========================================
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
define("_DOCTYPE_", "STYLE");
include "./$cfg[shop_dir]/shop.lib.php";
$html_title = "경매";
$base_qstr = "doc=$doc";
?>
<table width=100% border=0 cellpadding=0 cellspacing=1 align=center>
<?
if (!$ssort) {
$ssort = "au_id";
$sorder = "desc";
}
$from = " $cfg[table_auction] a
left join $cfg[table_tbidder] b on (a.au_id = b.au_id) ";
$query = new listQuery();
$query->select(" a.au_id, a.au_subject, a.au_fr_datetime, a.au_to_datetime, a.au_sijakga, a.au_juksiga, a.au_qty ");
$query->from($from);
$query->where($sselect, $stext, $condition);
$query->order($ssort, $sorder);
$query->group(" count(b.bi_id) as cnt, max(b.bi_ipchalga) as hyunjaega, sum(b.bi_qty) as sum_qty ");
$query->limit($cfg[list_rows], $page);
$sql = $query->result();
$result = sql_query($sql);
for ($i=0; $row=mysql_fetch_array($result); $i++) {
$status = get_auction_status($row);
$au_subject = conv_subject($row[au_subject], 100, "…");
// 입찰이 없다면 시작가가 현재가
if ($row[hyunjaega]) {
$hyunjaega = $row[hyunjaega];
} else {
$hyunjaega = $row[au_sijakga];
}
$comment_cnt = "";
$sql2 = " select count(*) from $cfg[table_tcomment]
where au_id = '$row[au_id]' ";
$row2 = sql_fetch($sql2);
if ($row2[0]) {
$comment_cnt = " <span style='font-size:8pt;'>($row2[0])</span>";
}
$list = ($i%3);
echo "<tr>";
echo "<td width=100 rowspan=6 valign=top><table width=99 border=0 cellpadding=0 cellspacing=0>";
echo "<tr><td width=99 height=24 background=images/pro_top.gif align=center valign=bottom>";
echo "<b><font color=red>$status</font></b></td></tr>";
echo "<tr><td width=99 height=74 align=center valign=top background=images/pro_main.gif>";
echo "<a href='./?doc=$cfg[shop_dir]/auctiondetail.php&au_id=$row[au_id]'>
<img src='./$cfg[shop_dir]/img/auction/$row[au_id]_0' width=80 height=65 border=0></a> <----요부분이 이미지 불러오는 부분입니다. 전 첫번째 이미지를 불러오는 것을 기본으로 하여 $row[au_id]_0 로 하였습니다. 그러면 경매번호를 기준으로 0~4까지중에서 0번이미지를 불러옵니다. 사이즈는 메인에 따라서 정하시면 됩니다. 물론 자동으로 조절하게끔 하면 되지만 아직 실력이 미진하여...전 사이즈를 정했습니다. 참고하세요... ---->
</td></tr>
</table></td>";
echo "<tr><td align=center>[<font color=blue><b>$au_subject</b></font>]{$comment_cnt}</td></tr>";
echo "<tr><td>마감일 : $row[au_to_datetime] (".get_yoil($row[au_to_datetime]).")</td></tr>";
echo "<tr><td>현재가 : ".nf($hyunjaega)." 원 </td></tr>";
?>
<script language="JavaScript">
<?
$tgap = strtotime($row[au_to_datetime]) - time();
$tday = (int)($tgap / 86400);
$thour = (int)(($tgap - ($tday * 86400)) / 3600);
$tmin = (int)(($tgap - ($tday * 86400 + $thour * 3600)) / 60);
$tsec = (int)($tgap - ($tday * 86400 + $thour * 3600 + $tmin * 60));
?>
var tday = <?=$tday?>;
var thour = <?=$thour?>;
var tmin = <?=$tmin?>;
var tsec = <?=$tsec?>;
function runtimer()
{
var s = "";
if (tday > 0)
s += tday + "일";
if (thour > 0 || s != "") {
if (s != "") s += " ";
s += thour + "시간";
}
if (tmin > 0 || s != "") {
if (s != "") s += " ";
s += tmin + "분";
}
if (tsec > 0 || s != "") {
if (s != "") s += " ";
s += tsec + "초";
}
if (s == "") {
document.fdetail.timer.value = "경매가 마감 되었습니다";
return;
}
document.fdetail.timer.value = s;
tsec--;
if (tsec < 0) {
tsec = 59;
tmin--;
}
if (tmin < 0) {
tmin = 59;
thour--;
}
if (thour < 0) {
thour = 23;
tday--;
}
window.setTimeout('runtimer()',1000);
}
</script>
<tr>
<form name=fdetail><td align=center>
<? if ($is_end) { ?>
<font color=crimson><b>경매 마감</b></font>
<? } else { ?>
<input type="text" name="timer" style='background-color: #ffffff ; border-style:none 0px; color:crimson; font-weight:bold;height:16; font-size:12; border-width: 0px;' readonly>
<script> runtimer(); </script>
<? } ?>
</td>
</form>
<?
echo "<tr><td align=center><a href='./?doc=$cfg[shop_dir]/auctiondetail.php&au_id=$row[au_id]'>
<img src=shop/auction_tender4.gif border=0 width=89 height=21></a> </td></tr>";
echo "</tr>";
}
if ($i == 0) {
echo "<tr><td colspan=9 align=center height=100 class='content contentbg'>자료가 없습니다.</td></tr>";
}
echo "</table>";
?>
==========================================================================================
요로코럼 만든후 메인에서 include방식을 취하였습니다.
즉 메인에서 <? include "./shop/auction_main.php"; ?>
원하는자리에 넣었습니다. 전 별이상없이 뜹니다. 참고하세요....
[이 게시물은 관리자님에 의해 2003-11-25 11:46:16 그샵팁텍(으)로 부터 이동됨]
추천
0
0
댓글 전체
맞아요....숫자가 1개이상이면 안되네염....쩝...

약간의 문제가 있습니다....
그 문제는 최근글 1개만 뽑으면 문제없이 작동되지만 1개이상되면
숫자가 작동불능이됩니다.
저도 그렇게 할려하다가 포기했습니다.^^
그 문제는 최근글 1개만 뽑으면 문제없이 작동되지만 1개이상되면
숫자가 작동불능이됩니다.
저도 그렇게 할려하다가 포기했습니다.^^
에구 감사하구요 잘됩니다만 왼쪽하단 아래에 "페이지에 오류가 있습니다"
라구 뜨는군요..
초미님은 이상 없는지요?
갑성님/초미님 감사합니다^^
잘쓸께요~~~~
라구 뜨는군요..
초미님은 이상 없는지요?
갑성님/초미님 감사합니다^^
잘쓸께요~~~~