별점 넣기

list.skin.php에서 제목옆에 별점을 표시해보았습니다.
write.skin.php에서 여분필드 wr_1을 사용하여 별점을 입력하는 방법을 사용했습니다.
아마추어가 좌충우돌하면서 별점을 넣어보았습니다
실력이 더 있으면 별점을 변수에 담아서 실렉트 박스로 구현하면 좋을텐데요.
list.skin.php pc.
[code]<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">별점</th>
<th scope="col">글쓴이</th>
<th scope="col"><?php echo subject_sort_link('wr_hit', $qstr2, 1) ?>조회 </a></th>
~중략~
<!-- 별점표시하기 시작 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style> .checked { color: orange; } </style>
<td class="td_name sv_use"><?php echo $list[$i]['wr_1'] ?></td>
<!-- 별점표시하기 종료 -->
<td class="td_name sv_use"><?php echo $list[$i]['name'] ?></td>
<td class="td_num"><?php echo $list[$i]['wr_hit'] ?></td>[/code]
list.skin.php mobile (작성자 앞에 넣어줍니다)
[code]<!-- 별점표시 시작 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style> .checked { color: orange; } </style>
<td class="td_name sv_use"><?php echo $list[$i]['wr_1'] ?></td>
<!-- 별점표시 종료 -->
<div class="bo_info">
<span class="sound_only">작성자</span><?php echo $list[$i]['name'] ?>[/code]
view.skin.php
[code]<!-- 별점표시 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.checked { color: orange; }
</style>
<p id="kp" style="font-size: 16px"><?php echo $view['wr_1']; ?></p>
<!-- 별점표시 -->[/code]
write.skin.php
[code]<input type=text class="frm_input full_input" name="wr_1" value="<?php echo $write['wr_1']; ?>" placeholder="별점표시:wr_1">[/code]
여분필드 wr_1입력칸에 별점을 표시하는 다음코드를 입력해줍니다. 무식하게 별갯수를 그대로 복사해서 입력하는 방법을 사용했습니다.
실력자분께서 별점을 변수에 담아서 실렉트박스로 선택해서 입력할 수있는 방법을 알려주시면 고맙겠습니다.
별한개: <span class="fa fa-star checked"></span>
별두개:
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
별세개:
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
별네개:
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
별다섯개
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
<span class="fa fa-star checked"></span>
댓글 6개
<select name="wr_1" id="wr_1" class="rating>
<option value="5" <?php echo $wr_1 == 5 ? 'selected' : ''; ?>>★★★★★</option>
<option value="4" <?php echo $wr_1 == 4 ? 'selected' : ''; ?>>★★★★</option>
<option value="3" <?php echo $wr_1 == 3 ? 'selected' : ''; ?>>★★★</option>
<option value="2" <?php echo $wr_1 == 2 ? 'selected' : ''; ?>>★★</option>
<option value="1" <?php echo $wr_1 == 1 ? 'selected' : ''; ?>>★</option>
</select>
view.skin.php || list.skin.php
view일 경우 $view['wr_1'] 사용
list일 경우 $list[$i]['wr_1'] 사용
별점 출력할 곳에
for($k=0;$k<페이지에 맞는 wr_1값;$k++){
echo '<i class="fa fa-star" aria-hidden="true"></i>';
}
로... wr_1 에 저장된 값만큼 별 아이콘을 불러오게끔 하면 될 것 같아요
전 아마추어에 끼지도 못하는 정도라.... 생각나는대로 적어봤는데 될 지 안 될지는 모르겠지만
말씀해주신 select 이나 radio 로 구현한다면 저런 느낌으로 하면 되지 않을까 싶어요!!
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4417 | ||
| 2154 | 3년 전 | 3228 | ||
| 2153 | 3년 전 | 2723 | ||
| 2152 |
|
3년 전 | 2592 | |
| 2151 | 3년 전 | 2228 | ||
| 2150 | 3년 전 | 2610 | ||
| 2149 | 3년 전 | 4228 | ||
| 2148 | 3년 전 | 3500 | ||
| 2147 | 3년 전 | 1910 | ||
| 2146 | 3년 전 | 2889 | ||
| 2145 | 3년 전 | 4021 | ||
| 2144 | 3년 전 | 2936 | ||
| 2143 | 3년 전 | 2302 | ||
| 2142 |
welcome
|
3년 전 | 2090 | |
| 2141 | 3년 전 | 2480 | ||
| 2140 |
|
3년 전 | 3481 | |
| 2139 |
|
3년 전 | 3229 | |
| 2138 | 3년 전 | 3248 | ||
| 2137 | 3년 전 | 3013 | ||
| 2136 | 3년 전 | 3134 | ||
| 2135 | 3년 전 | 3746 | ||
| 2134 | 3년 전 | 3305 | ||
| 2133 | 3년 전 | 3463 | ||
| 2132 |
|
3년 전 | 5320 | |
| 2131 | 3년 전 | 2358 | ||
| 2130 | 3년 전 | 3952 | ||
| 2129 |
|
3년 전 | 2947 | |
| 2128 | 3년 전 | 2978 | ||
| 2127 | 3년 전 | 4296 | ||
| 2126 | 3년 전 | 2553 | ||
| 2125 | 3년 전 | 2706 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기