이것좀 자세하게 설명해주세요 정보
이것좀 자세하게 설명해주세요본문
http://sir.co.kr/bbs/board.php?bo_table=yc4_qa&wr_id=52705#c_52713
이런 답변을 받았는데.어떻게 하라는것인지 잘 모르겠네요
lib/shop.lib.php 의
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
위 코드에서
아이콘 출력 부분의 코드만 분리합니다.
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
위 코드를 적절히 수정하신후
echo $it_icon($it);
와 같은 방법으로 사용해 보시기 바랍니다.
////아이콘 관련 부분만 분리하라는게 어떤 의미인지
lib/shop.lib.php에 있는부분을 분리해서 item페이지에 넣어라는 것인지
lib/shop.lib.php에 본래있던 아이콘 관련 내용을 지우고
lib/shop.lib.php다른 부분에 넣어라는것인지
좀 자세하게 설명해주실분?
이런 답변을 받았는데.어떻게 하라는것인지 잘 모르겠네요
lib/shop.lib.php 의
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
위 코드에서
아이콘 출력 부분의 코드만 분리합니다.
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
위 코드를 적절히 수정하신후
echo $it_icon($it);
와 같은 방법으로 사용해 보시기 바랍니다.
////아이콘 관련 부분만 분리하라는게 어떤 의미인지
lib/shop.lib.php에 있는부분을 분리해서 item페이지에 넣어라는 것인지
lib/shop.lib.php에 본래있던 아이콘 관련 내용을 지우고
lib/shop.lib.php다른 부분에 넣어라는것인지
좀 자세하게 설명해주실분?
댓글 전체
shop.lib.php 파일에서
function it_name_icon($it, $it_name="", $url=1) {
~~~
}
이 함수 아래쪽에 답변에 있는 함수 추가하고
function it_icon($it) {
~~~
}
item.php 파일에서 아이콘 출력하고 싶은 부분에
<?php echo $it_icon($it); ?> 를 추가하면 됩니다.
function it_name_icon($it, $it_name="", $url=1) {
~~~
}
이 함수 아래쪽에 답변에 있는 함수 추가하고
function it_icon($it) {
~~~
}
item.php 파일에서 아이콘 출력하고 싶은 부분에
<?php echo $it_icon($it); ?> 를 추가하면 됩니다.
<?php echo $it_icon($it); ?> 추가했더니.헤드 아랫부분이 안나와요 ㅎㅎ
어떻게 추가하셨나요?
itam.php에
<? php echo $it_icon($it); ?> 이렇게요
<? echo $it_icon($it); ?> 이렇게도 해보고..
<?php echo $it_icon($it); ?>이렇게도 해보고..
shop.lib.php 파일에서 이부분 잘라내서 아래에 넣어주고요
// 상품이름
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
// 아이콘 부분
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
<? php echo $it_icon($it); ?> 이렇게요
<? echo $it_icon($it); ?> 이렇게도 해보고..
<?php echo $it_icon($it); ?>이렇게도 해보고..
shop.lib.php 파일에서 이부분 잘라내서 아래에 넣어주고요
// 상품이름
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
// 아이콘 부분
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
function it_name_icon($it, $it_name="", $url=1) 부분에
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
이 다음에
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
는 지우시지 마시구요
echo $it_icon($it); 가 아니라 echo it_icon($it); 로 해야겠네요~
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
이 다음에
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
는 지우시지 마시구요
echo $it_icon($it); 가 아니라 echo it_icon($it); 로 해야겠네요~
성공했네요.
고맙습니다.^^
function it_name_icon($it, $it_name="", $url=1) 이부분에
아이콘관련
if ($it[it_type1]) $str .= <................ 지워도 되네요
<? echo it_icon($it); ?> 이 코드가 가해결책였나봐요
저처럼 암것도 모르거나 말귀어두운 분을위해 남깁니다.
========================================================================
shop.lib.php 원래 소스는 그대로 두고
// 상품이름
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
그 아래에 이것만 새로 넣어주고^^
// 아이콘
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
itam.php 아이콘 나오길 원하는 부분에<? echo it_icon($it); ?>삽입
고맙습니다.^^
function it_name_icon($it, $it_name="", $url=1) 이부분에
아이콘관련
if ($it[it_type1]) $str .= <................ 지워도 되네요
<? echo it_icon($it); ?> 이 코드가 가해결책였나봐요
저처럼 암것도 모르거나 말귀어두운 분을위해 남깁니다.
========================================================================
shop.lib.php 원래 소스는 그대로 두고
// 상품이름
function it_name_icon($it, $it_name="", $url=1)
{
global $g4;
$str = "";
if ($it_name)
$str = $it_name;
else
$str = stripslashes($it[it_name]);
if ($url)
$str = "<a href='$g4[shop_path]/item.php?it_id=$it[it_id]'>$str</a>";
// 품절
$stock = get_it_stock_qty($it[it_id]);
if ($stock <= 0)
$str .= " <img src='$g4[shop_img_path]/icon_pumjul.gif' border='0' align='absmiddle' /> ";
return $str;
}
그 아래에 이것만 새로 넣어주고^^
// 아이콘
function it_icon($it)
{
global $g4;
if ($it[it_type1]) $str .= " <img src='$g4[shop_img_path]/icon_type1.gif' border='0' align='absmiddle' />";
if ($it[it_type2]) $str .= " <img src='$g4[shop_img_path]/icon_type2.gif' border='0' align='absmiddle' />";
if ($it[it_type3]) $str .= " <img src='$g4[shop_img_path]/icon_type3.gif' border='0' align='absmiddle' />";
if ($it[it_type4]) $str .= " <img src='$g4[shop_img_path]/icon_type4.gif' border='0' align='absmiddle' />";
if ($it[it_type5]) $str .= " <img src='$g4[shop_img_path]/icon_type5.gif' border='0' align='absmiddle' />";
return $str;
}
itam.php 아이콘 나오길 원하는 부분에<? echo it_icon($it); ?>삽입