블로그 이미지

개발로그 - DevLog

프레임워크(framework), 웹2.0 등 개발기술과 서비스 by 태미(taemy)


텍스트큐브용 - google search 검색결과를 블로그 내에 넣기(검색용 애드센스)

구글 검색 결과를 블로그 내에 넣는 방법의 글을 썼었는데(태터툴즈용),
텍스트 큐브(이하 큐브)로 업그레이드 하면서,
코드의 변화가 있었는지 스킨이 제대로 작동되지 않았다.

그래서 큐브의 코드를 살펴보았다.
무척 간단하게 코드가 바뀌어 적용하기 더 쉬워졌다.

구글 검색 결과는 {큐브 접속주소}/gsearch/OOOO 형태로 검색이 된다.
아래 코드의 gsearch 부분은 원하는 이름으로 바꾸어 사용할 수 있다.

{큐브 설치 폴더}/blog/gsearch/index.php 파일이다.
이전 태터툴즈에서는 모든 코드를 index.php  파일에 넣었었다.

[code html]
<?php
/// Copyright (c) 2004-2007, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)
define('ROOT', '../..');
require ROOT . '/lib/includeForBlog.php';
if (false) {
        fetchConfigVal();
}
//$locatives = getLocatives($blogid);
require ROOT . '/lib/piece/blog/begin.php';
require ROOT . '/lib/piece/blog/gsearch.php';
require ROOT . '/lib/piece/blog/end.php';
?>

[/code]
위 코드의 gsearch.php 파일은 새로 만들어야 한다.

{큐브 설치 폴더}/lib/piece/blog/gsearch.php 에 구글검색결과 코드를 넣어준다.
[code html]
<?php
/// Copyright (c) 2004-2007, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/doc/LICENSE, /doc/COPYRIGHT)

// 2007-09-20 : google search modify
// localog -> googleSearch

$googleSearchView = "<div class=\"localog\">
<div style=\"background:url('http://www.google.com/logos/Logo_25wht.gif') top left no-repeat; font-weight:bold; font-size:12pt; width:600px; height:30px; padding-top:5px; padding-left:90px; border-bottom:1px solid #000;\">구글검색</div>

<!-- Google Search Result Snippet Begins -->
<div id=\"googleSearchUnitIframe\"></div>

<script type=\"text/javascript\">
   var googleSearchIframeName = 'googleSearchUnitIframe';
   var googleSearchFrameWidth = 700;
   var googleSearchFrameborder = 0 ;
   var googleSearchDomain = 'www.google.co.kr';
</script>
<script type=\"text/javascript\"
         src=\"http://www.google.com/afsonline/show_afs_search.js\">
</script>
<!-- Google Search Result Snippet Ends -->
</div>
";

dress('local',$googleSearchView,$view);

?>

[/code]
다음 코드이다.

예전 코드는 컨텐츠영역 이외의 부분까지 코드에 들어가 있어 수정하기 상대적으로 복잡했지만, 큐브의 코드는 수정하기 편해졌다.

이런식으로 사용하는 블로거가 있을지 모르겠지만, 글을 남겨둔다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
크리에이티브 커먼즈 라이선스
Creative Commons License
Comment 2 Trackback 0
  1. 도아 2007/09/22 06:02 address edit & delete reply

    검색용 애드센스 보다는 CSE(http://offree.net/entry/Google-Custom-Search-Engine )를 이용하고 애드센스와 연동하는 것이 더 좋은 것 같더군요. 저는 CSE로 홈페이지, 블로그, 미투로그를 통합했습니다.

    벌써 추석이군요. 즐거운 주말, 풍성한 한가위되세요.

    • 태미(taemy) 2007/09/22 20:37 address edit & delete

      CSE 가 더 좋은가봐요? 한번 시도해봐야 겠네요. ^^

      도아님도 즐거운 추석 보내세요. ^^

Trackback : http://devlog.experlab.com/trackback/362 관련글 쓰기

Top

prev 1 ... 80 81 82 83 84 85 86 87 88 ... 380 next