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

재미있는 표현법 질문드립니다. 채택완료

무와보 8년 전 조회 4,854

안녕하세요~

 

재미있는 최신글을 준비해보고 있는데요.

게시글 여분필드의 숫자를 최신글에서 표현할 때 숫자 대신에 그 수만큼의 그림으로 표현해보고자 합니다.

예를 들어 wr_1 필드에 3이라고 입력했을 경우

최신글에서 사과그림 3개가 나오게 한다거나

wr_2 필드에 숫자 6을 입력했을 경우

최신글에서 <i class="fa fa-male" aria-hidden="true"></i> 폰트어썸 사람 아이콘이 여섯개 나오게 하는 식의 방법을 찾고 있습니다.

 

이렇게 최신글에서 불러 올 수 있을까요?

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

답변 1개

채택된 답변
+20 포인트
그림자밟기

latest.skin.php

루프문 안에서 대략 이런식이겠죠.

 

</span></p><p>if($list[$i]['wr_1']+0) {</p><p><span style="font-size: 14.6667px; line-height: 22.0001px;">    $text_img = '';</span> </p><p>    for($j = 0; $j < <span style="font-size: 14.6667px; line-height: 1.5;">$list[$i]['wr_1']; $j++) {</span></p><p><span style="font-size: 14.6667px; line-height: 1.5;">        $text_img .= '</span><span class="nt" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;"><i</span><span style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;"> </span><span class="na" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;">class=</span><span class="s" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;">"fa fa-male"</span><span style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;"> </span><span class="na" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;">aria-hidden=</span><span class="s" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;">"true"</span><span class="nt" style="font-size: 11pt; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; line-height: 25.2072px;">></i></span><span style="font-size: 14.6667px; line-height: 1.5;">';</span></p><p><span style="font-size: 14.6667px; line-height: 1.5;">    }</span></p><p><span style="font-size: 14.6667px; line-height: 1.5;">    echo </span><span style="font-size: 14.6667px; line-height: 22.0001px;">$text_img;</span></p><p>}</p><p><span style="font-size: 11pt; line-height: 1.5;">

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

답변에 대한 댓글 1개

무와보
8년 전
아~ 이렇게 하는거군요..
여분필드의 숫자를 for문에서 바로 인식을 할 수 있다는 생각은 아예 못해봤습니다.
이렇게 또 하나 배워갑니다.
감사합니다 ^^

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

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

로그인