최신글 제목 길이 줄이는 법
여기 질문 게시판을 검색해 보니 저와 같은 질문에 답이 있었습니다. 그것은...
"/skin/latest/basic/latest.skin.php 파일에서
echo $list[$i]['subject'];
위 코드를 아래 코드로 수정합니다.
echo cut_str($list[$i]['wr_subject'], 8, "...");"
위와 같은 답이었습니다.
그러나 최근에 그누커머스를 설치한 제 파일에는 "echo $list[$i]['subject'];"
이런 글이 없습니다.
아마 다른 곳을 손 봐야 할 것 같은데 아시는 분에게 도움을 청합니다.
감사합니다.
참고로 lastest skin php의 소스는 다음과 같습니다.
if (!defined('GC_NAME')) exit; // 개별 페이지 접근 불가
//include_once( GC_LIB_PATH.'/thumbnail.lib.php' ); //리스트에서 이미지를 사용할시 사용
if( !is_array($list) ) return;
// $gc_page_url 이 빈값으로 나올 경우 숏코드에 해당 url을 입력, 또는 게시판 기본 설정에서 적용할 페이지을 설정해 주시면 됩니다.
?>
foreach($list as $row) { if( !isset($row['wr_id']) ) continue; /* $thumb = gc_get_list_thumbnail($bo_table, $row['wr_id'], 100, 100);
if($thumb['src']) { //이미지가 있을때 $img_content = ' } else { //이미지가 없을때 $img_content = 'no image'; } */ ?> echo ""; if ($row['is_notice']) echo "".$row['subject'].""; else echo $row['subject'];
if ($row['comment_cnt']) echo $row['comment_cnt'];
echo "";
// if ($row['link']['count']) { echo "[{$row['link']['count']}]"; } // if ($row['file']['count']) { echo "<{$row['file']['count']}>"; }
if (isset($row['icon_new'])) echo " " . $row['icon_new']; if (isset($row['icon_hot'])) echo " " . $row['icon_hot']; if (isset($row['icon_file'])) echo " " . $row['icon_file']; if (isset($row['icon_link'])) echo " " . $row['icon_link']; if (isset($row['icon_secret'])) echo " " . $row['icon_secret']; ?> ';
답변 5개
으랏차차차...찾았다. 성공
두분 모두 감사합니다.
정답은...
echo gc_cut_str($row['subject'], 10);
였습니다. g5가 아닌 gc
댓글을 작성하려면 로그인이 필요합니다.
그누커머스를 사용했습니다.
gnucommerce/skin/latest/basic/latest.skin.php
두분 말씀 모두
echo $row['subject']; 을
echo cut_str($row['subject'], 8, "..."); 또는
echo g5_cut_str($row['subject'], 10); 으로 바꾸는 것인데... 두개 다 해보았지만 안됩니다.
g5 를 빼고 echo cut_str($row['subject'], 10); 으로 바꾸어 봤는데도 안되는군요.
헤...힘드네...헉헉...
댓글을 작성하려면 로그인이 필요합니다.
용좌님/ 왕계란님 답변 감사합니다.
주신 방법으로 해 보았는데 잘 안되는군요.
주신 소스가 맞는지 다시 한번 확인 부탁드립니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
if ($row['is_notice']) echo "".g5_cut_str($row['subject'], 10).""; else echo g5_cut_str($row['subject'], 10);
함수 저걸로 써 보세요.
댓글을 작성하려면 로그인이 필요합니다.
</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> <?php</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> echo "<a href=\"".esc_url($row['href'])."\">";</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px; color: rgb(255, 255, 255); background-color: rgb(142, 142, 142);"> if ($row['is_notice']) //공지 일 경우</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px; color: rgb(255, 255, 255); background-color: rgb(142, 142, 142);"> echo "<strong>".$row['subject']."</strong>"; //공지가 일 경우 제목</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px; color: rgb(255, 255, 255); background-color: rgb(142, 142, 142);"> else</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px; color: rgb(255, 255, 255); background-color: rgb(142, 142, 142);"> echo $row['subject']; //공지가 아닐 경우 제목 </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">//수정 방법 $row['subject']</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;">// echo cut_str($row['subject'], 8, "...");</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if ($row['comment_cnt'])</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> echo $row['comment_cnt'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> echo "</a>";</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> // if ($row['link']['count']) { echo "[{$row['link']['count']}]"; }</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> // if ($row['file']['count']) { echo "<{$row['file']['count']}>"; }</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if (isset($row['icon_new'])) echo " " . $row['icon_new'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if (isset($row['icon_hot'])) echo " " . $row['icon_hot'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if (isset($row['icon_file'])) echo " " . $row['icon_file'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if (isset($row['icon_link'])) echo " " . $row['icon_link'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> if (isset($row['icon_secret'])) echo " " . $row['icon_secret'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"><font color="#505050" face="돋움, Dotum, sans-serif"></font><span style="font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> ?></span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; letter-spacing: -0.01px; line-height: 25.2072px;"> </p><p>
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인