영

환경설정에서 추가 script, css 부분에 내용 일부만이 보입니다.

· 2013-06-03 (월) 12:57:52 · 852 · 4
g4s4.0-b27을 설치했습니다.

환경설정에서 추가 script, css 부분에 favicon 과 css 을 위해 두 줄을 추가했습니다.
그리고, 설정 저장하기 위해 페이지 아래에 [확인]버튼을 눌러주었습니다.

이렇게 설정한 후, 다시 추가 script, css 부분 textarea를 보면, 첫줄 favicon 내용만 보이고, css 내용이 보이지를 않습니다.

DB를 살펴보니, 제대로 입력되어있고, 적용된 웹페이지에서 소스보기 해도 둘 다 추가되어있습니다.

좀 더 파고 들어보니....

---
<link rel="shortcut icon" href="http://domain.org/ico/favicon.ico" /><link rel="stylesheet" href="http://domain.org/css/korea.css" />
---
위와 같이 한줄에 연결해서 추가하니 잘 보입니다.


아래처럼 엔터치고 두 줄로 작성하면 첫줄 내용만 보입니다.
---
<link rel="shortcut icon" href="http://domain.org/ico/favicon.ico" />
<link rel="stylesheet" href="http://domain.org/css/korea.css" />
---




항상 감사드립니다.^^
|

댓글 4개

첫번째 favicon 설정 뒤에 엔터치고 <script... 태그를 붙였더니, 그건 또 잘 나오네요.. 엔터가 문제가 아닌가....?
<link rel="shortcut icon" href="http://domain.org/ico/favicon.ico" />
<script>
var newstyle=document.createElement("link");
newstyle.type = "text/css";
newstyle.rel = "stylesheet";
newstyle.href = "http://domain.org/css/korea.css";
document.head.appendChild(newstyle);
</script>

이런식으로 적용해 보시기 바랍니다.
말씀하신 것처럼 <script>...</script>는 잘 나옵니다. css 즉,
<link rel="stylesheet" href="http://domain.org/css/korea.css" /> 이녀석만 엔터치고 다음줄에 추가해주면 사라집니다. 나타나지 않는 그자리엔 빈줄 한줄이 보입니다.
물론 DB에는 잘 들어가 있습니다.
css 의 경우 lib/common.lib.php 의 function html_end() 에서 파싱이 되어 그렇습니다.

// 버퍼의 내용에서 body 태그 중간의 외부 css 파일을 CAPTURE 하여 head 태그로 이동시켜준다.
$buffer = ob_get_contents();
ob_end_clean();
preg_match('#<body>(.*)</body>#is', $buffer, $bodys);
preg_match_all('/(\r|\n)<link[^>]+>/i', $bodys[0], $links);
$stylesheet = '';
$links[0] = array_unique($links[0]);
foreach ($links[0] as $key=>$link) {
//$link = PHP_EOL.$links[0][$i];
$stylesheet .= $link;
$buffer = preg_replace('#'.$link.'#', '', $buffer);
}
/*
</title>
<link rel="stylesheet" href="default.css">
밑으로 스킨의 스타일시트가 위치하도록 하게 한다.
*/
return preg_replace('#(</title>[^<]*<link[^>]+>)#', "$1$stylesheet", $buffer);

제가 알려드린 코드를 사용하셔야 할것 같습니다.
댓글을 작성하시려면 로그인이 필요합니다.

버그신고

4,191건

  문의게시판을 이용해 주세요 :) https://sir.kr/co_qa  

+
분류 제목 글쓴이 날짜
13-06-03
13-06-03
13-06-03
13-06-02
13-06-02
13-05-29
13-05-29
13-05-27
13-05-24
13-05-24
13-05-23
13-05-23
13-05-23
13-05-22
13-05-22
13-05-22
13-05-22
13-05-22
13-05-21
13-05-21