2003년 1월 8일 이후 
모두 명  오늘 명 
메인 페이지  
칼럼 보기  
카툰 보기  
게시판 가기  
사이트맵  
그밖의 것들  

가입하면 정말 편합니다;;
자유 게시판
질답 게시판
유용한 정보
 

QnA
묻고 답하기
질문전 검색은 기본!!!
질문 내용은 최대한 자세하고 정확하게!!!!!

 [re] 아이콘 include 해서 쓰는 방법  
 리디  posted at 2003-09-23 09:36:10
1690 hits  2 comments
reedyfox is level 39  llllllllll 
 퍼머링크 : http://reedyfox.com/island.php/qna/174  [복사]
파일 세 개를 만듭니다. 각 파일은 제로보드 디렉토리의 include 디렉토리
안에 넣습니다. 특별한 이유는 없고 그냥 인클루드 파일이니까 거기에 넣는게
좋을 것 같아 그렇게 했습니다.

1) emo_w.php
이모티콘을 textarea에 입력하는 부분입니다. 글쓰기나 코멘트 쓰기에서 같이
인클루드 할 수 있습니다. 파일 내용은 다음과 같습니다.

<table width=100% border=0 cellpadding=0 cellspacing=3><tr height=20><td>
<a href="JavaScript:onclick=AddChar('([웃음]]');"><img src=../2img/emo/smile1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([씨익]]');"><img src=../2img/emo/smile2.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([으힛]]');"><img src=../2img/emo/smile3.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([윙크]]');"><img src=../2img/emo/smile4.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([므흣]]');"><img src=../2img/emo/smile5.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([메렁]]');"><img src=../2img/emo/smile6.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([하이]]');"><img src=../2img/emo/hand1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([원츄]]');"><img src=../2img/emo/hand2.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([비추]]');"><img src=../2img/emo/hand3.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([헤헷]]');"><img src=../2img/emo/hand4.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([유효]]');"><img src=../2img/emo/agree.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([무효]]');"><img src=../2img/emo/hand5.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([벙뜸]]');"><img src=../2img/emo/oops1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([으에]]');"><img src=../2img/emo/oops2.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([으으]]');"><img src=../2img/emo/oops3.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([에혀]]');"><img src=../2img/emo/oops4.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([부끄]]');"><img src=../2img/emo/oops5.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([헉]]');"><img src=../2img/emo/oops6.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([제발비밀]]');"><img src=../2img/emo/oops7.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([기도]]');"><img src=../2img/emo/oops8.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([잔다]]');"><img src=../2img/emo/oops9.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([아니]]');"><img src=../2img/emo/notgood1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([뜨아]]');"><img src=../2img/emo/notgood2.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([이게머여]]');"><img src=../2img/emo/notgood3.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([얼었음]]');"><img src=../2img/emo/notgood4.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([저것이]]');"><img src=../2img/emo/notgood5.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([으이그]]');"><img src=../2img/emo/notgood6.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([한판붙자]]');"><img src=../2img/emo/notgood7.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([우울]]');"><img src=../2img/emo/sick1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([낭패]]');"><img src=../2img/emo/sick2.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([엉엉]]');"><img src=../2img/emo/sick3.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([열이펄펄]]');"><img src=../2img/emo/sick4.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([우엑]]');"><img src=../2img/emo/sick5.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([마스크]]');"><img src=../2img/emo/sick6.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([취한다]]');"><img src=../2img/emo/sick7.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([보노보노]]');"><img src=../2img/emo/bonobono.gif border=0 alt=마프님꺼 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([보노땀]]');"><img src=../2img/emo/bono_sweat.gif border=0 alt=마프님꺼 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([베이더]]');"><img src=../2img/emo/darth.gif border=0 alt=소금님꺼 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([레드광선검]]');"><img src=../2img/emo/red_sword.gif alt=마프님꺼 border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([그린광선검]]');"><img src=../2img/emo/green_sword.gif alt=마프님꺼 border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([광선검교차]]');"><img src=../2img/emo/two_sword.gif alt=마프님꺼 border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([토토로1]]');"><img src=../2img/emo/totoro1.gif border=0 align=absmiddle></a>
<a href="JavaScript:onclick=AddChar('([토토로2]]');"><img src=../2img/emo/totoro2.gif border=0 align=absmiddle></a>
</td>        </tr></table>


인클루드는 다음과 같이 합니다. (스킨디렉의 write.php 와 view_write_comment.php)
<span id=MyMenu style='line-height:150%;display:none;'>
<? include "include/emo_vwc.php"; ?>
</span>


2) emo_v.php
게시물에서 글내용을 필터링해 이모티콘으로 바꿔주는 부분입니다.
내용은 다음과 같습니다.

<?php
$memo = str_replace("([웃음]]" ,"<img src=../2img/emo/smile1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([씨익]]" ,"<img src=../2img/emo/smile2.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([으힛]]" ,"<img src=../2img/emo/smile3.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([윙크]]" ,"<img src=../2img/emo/smile4.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([므흣]]" ,"<img src=../2img/emo/smile5.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([메렁]]" ,"<img src=../2img/emo/smile6.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([하이]]" ,"<img src=../2img/emo/hand1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([원츄]]" ,"<img src=../2img/emo/hand2.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([비추]]" ,"<img src=../2img/emo/hand3.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([헤헷]]" ,"<img src=../2img/emo/hand4.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([유효]]" ,"<img src=../2img/emo/agree.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([무효]]" ,"<img src=../2img/emo/hand5.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([벙뜸]]" ,"<img src=../2img/emo/oops1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([으에]]" ,"<img src=../2img/emo/oops2.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([으으]]" ,"<img src=../2img/emo/oops3.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([에혀]]" ,"<img src=../2img/emo/oops4.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([부끄]]" ,"<img src=../2img/emo/oops5.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([헉]]" ,"<img src=../2img/emo/oops6.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([제발비밀]]" ,"<img src=../2img/emo/oops7.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([기도]]" ,"<img src=../2img/emo/oops8.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([잔다]]" ,"<img src=../2img/emo/oops9.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([아니]]" ,"<img src=../2img/emo/notgood1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([뜨아]]" ,"<img src=../2img/emo/notgood2.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([이게머여]]" ,"<img src=../2img/emo/notgood3.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([얼었음]]" ,"<img src=../2img/emo/notgood4.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([저것이]]" ,"<img src=../2img/emo/notgood5.gif border=0 align=absmiddle>" , $memo);
$memo = str_replace("([으이그]]" ,"<img src=../2img/emo/notgood6.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([한판붙자]]" ,"<img src=../2img/emo/notgood7.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([우울]]" ,"<img src=../2img/emo/sick1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([낭패]]" ,"<img src=../2img/emo/sick2.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([엉엉]]" ,"<img src=../2img/emo/sick3.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([열이펄펄]]" ,"<img src=../2img/emo/sick4.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([우엑]]" ,"<img src=../2img/emo/sick5.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([마스크]]" ,"<img src=../2img/emo/sick6.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([취한다]]" ,"<img src=../2img/emo/sick7.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([보노보노]]" ,"<img src=../2img/emo/bonobono.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([보노땀]]" ,"<img src=../2img/emo/bono_sweat.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([베이더]]" ,"<img src=../2img/emo/darth.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([레드광선검]]" ,"<img src=../2img/emo/red_sword.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([그린광선검]]" ,"<img src=../2img/emo/green_sword.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([광선검교차]]" ,"<img src=../2img/emo/two_sword.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([토토로1]]" ,"<img src=../2img/emo/totoro1.gif border=0 align=absmiddle>", $memo);
$memo = str_replace("([토토로2]]" ,"<img src=../2img/emo/totoro2.gif border=0 align=absmiddle>", $memo);
?>

인클루드는 (스킨디렉) view.php 에서 다음과 같이 해줍니다.

<? include "include/emo_v.php"; ?>

주의할 점은, <?=$memo?> 앞에 인클루드 해주어야 합니다.


3) emo_vc.php
코멘트 내용을 필터링해 이모티콘으로 바꿔주는 부분입니다.
내용은 다음과 같습니다.

<?php
$c_memo = str_replace("([웃음]]" ,"<img src=../2img/emo/smile1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([씨익]]" ,"<img src=../2img/emo/smile2.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([으힛]]" ,"<img src=../2img/emo/smile3.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([윙크]]" ,"<img src=../2img/emo/smile4.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([므흣]]" ,"<img src=../2img/emo/smile5.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([메렁]]" ,"<img src=../2img/emo/smile6.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([하이]]" ,"<img src=../2img/emo/hand1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([원츄]]" ,"<img src=../2img/emo/hand2.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([비추]]" ,"<img src=../2img/emo/hand3.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([헤헷]]" ,"<img src=../2img/emo/hand4.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([유효]]" ,"<img src=../2img/emo/agree.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([무효]]" ,"<img src=../2img/emo/hand5.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([벙뜸]]" ,"<img src=../2img/emo/oops1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([으에]]" ,"<img src=../2img/emo/oops2.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([으으]]" ,"<img src=../2img/emo/oops3.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([에혀]]" ,"<img src=../2img/emo/oops4.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([부끄]]" ,"<img src=../2img/emo/oops5.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([헉]]" ,"<img src=../2img/emo/oops6.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([제발비밀]]" ,"<img src=../2img/emo/oops7.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([기도]]" ,"<img src=../2img/emo/oops8.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([잔다]]" ,"<img src=../2img/emo/oops9.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([아니]]" ,"<img src=../2img/emo/notgood1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([뜨아]]" ,"<img src=../2img/emo/notgood2.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([이게머여]]" ,"<img src=../2img/emo/notgood3.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([얼었음]]" ,"<img src=../2img/emo/notgood4.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([저것이]]" ,"<img src=../2img/emo/notgood5.gif border=0 align=absmiddle>" , $c_memo);
$c_memo = str_replace("([으이그]]" ,"<img src=../2img/emo/notgood6.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([한판붙자]]" ,"<img src=../2img/emo/notgood7.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([우울]]" ,"<img src=../2img/emo/sick1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([낭패]]" ,"<img src=../2img/emo/sick2.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([엉엉]]" ,"<img src=../2img/emo/sick3.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([열이펄펄]]" ,"<img src=../2img/emo/sick4.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([우엑]]" ,"<img src=../2img/emo/sick5.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([마스크]]" ,"<img src=../2img/emo/sick6.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([취한다]]" ,"<img src=../2img/emo/sick7.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([보노보노]]" ,"<img src=../2img/emo/bonobono.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([보노땀]]" ,"<img src=../2img/emo/bono_sweat.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([베이더]]" ,"<img src=../2img/emo/darth.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([레드광선검]]" ,"<img src=../2img/emo/red_sword.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([그린광선검]]" ,"<img src=../2img/emo/green_sword.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([광선검교차]]" ,"<img src=../2img/emo/two_sword.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([토토로1]]" ,"<img src=../2img/emo/totoro1.gif border=0 align=absmiddle>", $c_memo);
$c_memo = str_replace("([토토로2]]" ,"<img src=../2img/emo/totoro2.gif border=0 align=absmiddle>", $c_memo);
?>

emo_v.php와 차이점이라면 memo가 c_memo로 바뀐 것 뿐입니다.
인클루드는 다음과 같이 합니다. (스킨 디렉 view_comment.php)

<? include "include/emo_vc.php"; ?>

마찬가지로 $c_memo 앞에 있어야 합니다.


  PRINT Text  PRINT HTML  

  Trackbacks for this Posting (0)
'생각하는섬 바닷가 - [re] 아이콘 include 해서 쓰는 방법'

LIST ALL               GO TO THE TOP

- 이글 위에 있는 글 : 질문할 때 주의 사항
- 이글 아래 있는 글 : 질문드립니다 ^^:;

Copyright 1999-2021 Zeroboard

 
생각하는 섬, 바닷가는 리디가 운영하는 개인 칼럼 사이트이며 일부 컨텐츠는 리디 외의 필진에 의해 작성되었습니다. 이곳의 모든 컨텐츠는 출처(Deep Link URL) 및 작가를 명시하는 조건으로 비상업적 용도의 전제/복제가 가능합니다. 그러나 이곳에 게재된 컨텐츠의 취지 또는 작가의 의도가 왜곡되어 해석될 수 있는 컨텐츠 변형은 금지합니다. 이곳에 기재된 전자우편주소에 대한 일체의 수집행위를 거부합니다.(게시일 2008년 1월 1일)
Google
  성화민  
Window close