테스트 사이트 - 개발 중인 베타 버전입니다

태그를 sir 처럼 모아 소팅하고 싶어요. 채택완료

myfree 1년 전 조회 1,814

https://sir.kr/g5_plugin/1306?sfl=wr_subject&stx=%ED%83%9C%EA%B7%B8" rel="nofollow noreferrer noopener" target="_blank">https://sir.kr/g5_plugin/1306?sfl=wr_subject&stx=%ED%83%9C%EA%B7%B8

 

위 태그 기능을 이용해서 게시판에 태그기능을 추가시켰고,

지금 확인결과 정상적으로 잘됩니다.

 

아래 이미지처럼

list.skin.php 상단에 모아, 클릭시 소팅하고 싶어요.

 

 

http://sir.kr/data/editor/2404/237506203_1712193021.9576.jpg" />

 

 

 

 

@마르스컴퍼니 님께서 친절하게 답변주신 글  ( https://sir.kr/qa/530552 )

 

</p>

<p><?php</p>

<p>$sql = "select ct_tag, count(*) as cnt from comp_tag where bo_table = '{$bo_table}' </p>

<p>group by ct_tag order by 2 desc";

$result = sql_query($sql);

echo '<ul>';

while ($row = sql_fetch_array($result)) {

    echo '<li>';

    echo "{$row['ct_tag']} ({$row['cnt']})";

    echo '</li>';

}

echo '</ul>';

?></p>

<p>

 

 

 

 

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
1년 전

<?php

$sql = "select ct_tag, count(*) as cnt from comp_tag where bo_table = '{$bo_table}' 

group by ct_tag order by 2 desc";

$result = sql_query($sql);

?>

<ul>

<?php while ($row = sql_fetch_array($result)) { ?>

    <li><a href="<?php echo G5_BBS_URL?>/board.php?bo_table=<?php echo $bo_table ?>&sfl=tags&stx=<?php echo $row['ct_tag'] ?>"><?php echo $row['ct_tag'] ?> (<?php echo $row['cnt'] ?>)</a></li>

<?php } ?>

</ul>

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

d
1년 전

SELECT ct_tag, COUNT(*) AS cnt FROM comp_tag WHERE bo_table = '{$bo_table}' GROUP BY ct_tag ORDER BY cnt DESC;  처럼 해보세요

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

m
myfree
1년 전
[code]
<?php
$sql = "SELECT ct_tag, COUNT(*) AS cnt FROM comp_tag WHERE bo_table = '{$bo_table}' GROUP BY ct_tag ORDER BY cnt DESC;";
$result = sql_query($sql);
echo '<ul>';
while ($row = sql_fetch_array($result)) {
echo '<li>';
echo "{$row['ct_tag']} ({$row['cnt']})";
echo '</li>';
}
echo '</ul>';
?>
[/code]

이렇게 하라는 말씀이시지요.. 태그가 눌리거나 링크가 잡히지 않네요..

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인