style.css 파일에 "background:url(<?= " 사용법은 없나요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

style.css 파일에 "background:url(<?= " 사용법은 없나요? 정보

style.css 파일에 "background:url(<?= " 사용법은 없나요?

본문

style.css 파일에 백그라운드 불러올때 함수를 넣을수없나요?

아래처럼---
#container {
  background:url(<?=latest("basic","open",1,1?>);
  width:1080px;
  height:250px;
}

파일하나에 ex) 111.php에 아래처럼하면 불러오는데 상단처럼 style.css파일을 만들면  불러오지않네요.....
<style>
#container {
  background:url(<?=latest("basic","open",1,1?>);
  width:1080px;
  height:250px;
}
</style>

댓글 전체

흠..... 뭘 불러오든 background 라는건 jpg gif png 등 이미지를 불러오는거구요
<?=latest("basic","open",1,1?> 라는걸 불러와서 이미지가 보인들
이건 최근게시물에 의한 변수일뿐 이미지는 아니랍니다.
배너형식 이미지를 배경으로 넣고 싶으시다면 jquery 를 찾아보시는게 빨라요
이비아님 답변 정말 고맙습니다.
아래질문으로 바꿔야겠습니다.

style.css 파일에 백그라운드 불러올때 함수를 넣을수없나요?

아래처럼---
#container {
  background:url(<?php echo $g4['path']?>/latest/img/aaa.jpg);
  width:1080px;
  height:250px;
}

파일하나에 ex) 111.php에 아래처럼하면 불러오는데 상단처럼 style.css파일을 만들면  불러오지않네요.....
<style>
#container {
  background:url(<?php echo $g4['path']?>/latest/img/aaa.jpg);
  width:1080px;
  height:250px;
}
</style>
css 파일에서 php 구문을 쓰시니 당연히 안되죠.

http://css-tricks.com/css-variables-with-php/

참고하셔서  php 파일로 css 를 표현하셔야 합니다.

테스트 파일 상단에 command.php 파일 인쿠르드 하면 그누 함수를 불러다 쓸수가 있겠죠.
There is actually a performance issue. As far as I know, these php-parsed stylesheets do not get cached by the client. So the stylesheet is processed everytime it is called by the client.

해당 글을 작성하신 분도 퍼포먼스 이슈가 있다고 인정한 방법이네요.
흥미로운 방법인 건 사실이지만 적용하기는 어려울 듯... ㅠ
전체 66,558 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT