영카트 if문으로 클릭페이지에서 스타일을 활성화 시킬려구 합니다.
본문
날씨가 무덥습니다.
답변주시는 모든 여러분들께 앞서 감사드립니다.
영카트 상품리스트를 별도 페이지로 노출하여
클릭시 if문으로 스타일을 활성화 시킬려구 합니다.
<style>....</style>
<?php
if ($this->href) {
if($it_id == '0000000001') {
echo "<div class=\"sct_txt style01\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
} elseif ($it_id == '0000000002') {
echo "<div class=\"sct_txt style02\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
} else {
echo "<div class=\"sct_txt\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
}
}
?>
위치는 main.10.skin.php 입니다.
클릭한 상품 코드가 0000000001이면 클래스가 활성화 되고
만약 클릭한 상품 코드가 0000000002일땐 다른 클래스가 활성화 되고
조건에 해당없을땐 스타일이 비활성화 된다는 내용인데요..
if문이 안먹고 전부 스타일이 활성화되네요 ㅠㅠ
답답한 마음에 몇자 올려봅니다.
감사합니다.
!-->
답변 2
elseif 부분에서 else if 로 띄워서 일단 적용해 보세요.
해당 소스는 영카트 기본설치시 shop디렉토리에 있는 "main.10.skin.php" 파일입니다.
수정한 부분은 49번째줄에있습니다.
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// add_stylesheet('css 구문', 출력순서); 숫자가 작을 수록 먼저 출력됨
add_stylesheet('<link rel="stylesheet" href="'.G5_SHOP_SKIN_URL.'/style.css">', 0);
?>
<!-- 상품진열 10 시작 { -->
<?php
for ($i=1; $row=sql_fetch_array($result); $i++) {
if ($this->list_mod >= 2) { // 1줄 이미지 : 2개 이상
if ($i%$this->list_mod == 0) $sct_last = 'sct_last'; // 줄 마지막
else if ($i%$this->list_mod == 1) $sct_last = 'sct_clear'; // 줄 첫번째
else $sct_last = '';
} else { // 1줄 이미지 : 1개
$sct_last = 'sct_clear';
}
if ($i == 1) {
if ($this->css) {
echo "<ul class=\"{$this->css}\">\n";
} else {
echo "<ul class=\"sct sct_10\">\n";
}
}
echo "<li class=\"sct_li {$sct_last}\" style=\"width:{$this->img_width}px\">\n";
if ($this->href) {
echo "<!--div class=\"sct_img\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
}
if ($this->view_it_img) {
echo get_it_image($row['it_id'], $this->img_width, $this->img_height, '', '', stripslashes($row['it_name']))."\n";
}
if ($this->href) {
echo "</a></div-->\n";
}
if ($this->view_it_icon) {
echo "<div class=\"sct_icon\">".item_icon($row)."</div>\n";
}
if ($this->view_it_id) {
echo "<div class=\"sct_id\"><".stripslashes($row['it_id'])."></div>\n";
}
if ($this->href) {
if($it_id == '0000000001') {
echo "<div class=\"sct_txt style01\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
} else if ($it_id == '0000000001') {
echo "<div class=\"sct_txt style02\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
} else {
echo "<div class=\"sct_txt\"><a href=\"{$this->href}{$row['it_id']}\" class=\"sct_a\">\n";
}
}
if ($this->view_it_name) {
echo stripslashes($row['it_name'])."\n";
}
if ($this->href) {
echo "</a></div>\n";
}
if ($this->view_it_basic && $row['it_basic']) {
echo "<div class=\"sct_basic\">".stripslashes($row['it_basic'])."</div>\n";
}
if ($this->view_it_cust_price || $this->view_it_price) {
echo "<div class=\"sct_cost\">\n";
if ($this->view_it_cust_price && $row['it_cust_price']) {
echo "<strike>".display_price($row['it_cust_price'])."</strike>\n";
}
if ($this->view_it_price) {
echo display_price(get_price($row), $row['it_tel_inq'])."\n";
}
echo "</div>\n";
}
if ($this->view_sns) {
$sns_top = $this->img_height + 10;
$sns_url = G5_SHOP_URL.'/item.php?it_id='.$row['it_id'];
$sns_title = get_text($row['it_name']).' | '.get_text($config['cf_title']);
echo "<div class=\"sct_sns\" style=\"top:{$sns_top}px\">";
echo get_sns_share_link('facebook', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_fb_s.png');
echo get_sns_share_link('twitter', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_twt_s.png');
echo get_sns_share_link('googleplus', $sns_url, $sns_title, G5_SHOP_SKIN_URL.'/img/sns_goo_s.png');
echo "</div>\n";
}
echo "</li>\n";
}
if ($i > 1) echo "</ul>\n";
if($i == 1) echo "<p class=\"sct_noitem\">등록된 상품이 없습니다.</p>\n";
?>
<!-- } 상품진열 10 끝 -->
답변을 작성하시기 전에 로그인 해주세요.