WP+UTW+TAGF 적용Dec 01, 2006

Tag cloud 페이지TAGF(Tags in Flash) 를 적용했다. 태터툴즈용 플러그인이지만, WP나 TT나 태깅은 그게 그거라서 tag_vars.php 만 조금 고치면 바로 사용이 가능하더라.

2006년 12월 7일 추가 : Pod님플러그인으로 만드셨기 때문에 번거롭게 이런 패치를 하지 않아도 간편하게 사용할 수 있음.

PHP:
  1. --- tag_vars.php.orig   2006-12-02 20:59:15.872774440 +0900
  2. +++ tag_vars.php        2006-12-02 20:59:47.872909680 +0900
  3. @@ -1,15 +1,15 @@
  4.  <?
  5.  
  6. -require_once "../../config.php";
  7. +require_once "../../../../wp-config.php";
  8.  //설정정보 로드
  9.  
  10. -$tgf_host = $database['server'];
  11. -$tgf_id = $database['username'];                           
  12. -$tgf_pw = $database['password'];                   
  13. -$tgf_dbname = $database['database'];
  14. -$tgf_url="http://".$service['domain'].$service['path'];
  15. -$tgf_tagr = $database['prefix']."TagRelations";
  16. -$tgf_tags = $database['prefix']."Tags";
  17. +$tgf_host = DB_HOST;
  18. +$tgf_id = DB_USER;
  19. +$tgf_pw = DB_PASSWORD;
  20. +$tgf_dbname = DB_NAME;
  21. +$tgf_url = "";
  22. +$tgf_tagr = $table_prefix."post2tag";
  23. +$tgf_tags = $table_prefix."tags";
  24.  
  25.  ///////////////////
  26.  //표시될 갯수 설정
  27. @@ -76,12 +76,14 @@
  28.  global $tgf_host,$tgf_id,$tgf_pw,$tgf_dbname;
  29.  $DBconn = mysql_connect($tgf_host,$tgf_id,$tgf_pw);
  30.  mysql_select_db($tgf_dbname,$DBconn);
  31. +mysql_query("set names utf8");
  32. +$tgf_url = mysql_result(mysql_query("SELECT option_value FROM {$table_prefix}options WHERE option_name='siteurl'"), 0, 0);
  33.  
  34. -$sql = "SELECT a.tag, count(*), b.name
  35. -               FROM ".$tgf_tagr." a, ".$tgf_tags." b
  36. -               WHERE a.tag=b.id group by a.tag
  37. -               ORDER by 2 desc, b.name
  38. -               $limit";
  39. +$sql = "SELECT b.tag as name, COUNT(a.tag_id)
  40. +        FROM $tgf_tagr a, $tgf_tags b
  41. +        WHERE a.tag_id=b.tag_ID GROUP BY a.tag_id
  42. +        ORDER BY 2 DESC
  43. +        $limit";
  44.  $result = mysql_query($sql) or die(mysql_error());
  45.  //가져오기

UTW 에서 URL rewriting 이 작동하지 않을 때Oct 07, 2006

Ultimate Tag Warrior 플러그인을 설치해서 태그를 입력하고 있는데, 설정에서 아무리 url rewriting 을 켜줘도 도통 먹지를 않더라. 가만 보니 얘가 .htaccess 를 고쳐줘야하는데 본체만체. 그럼 직접 하는 수밖에..

CODE:
  1. RewriteRule ^tag/?(.*)/feed/(feed|rdf|rss|rss2|atom)/?$ /YOURSITE/index.php?tag=$1&feed=$2 [QSA,L]
  2. RewriteRule ^tag/?(.*)/page/?(.*)/$ /YOURSITE/index.php?tag=$1&paged=$2 [QSA,L]
  3. RewriteRule ^tag/?(.*)/$ /YOURSITE/index.php?tag=$1 [QSA,L]
  4. RewriteRule ^tag/?(.*)/page/?(.*)$ /YOURSITE/index.php?tag=$1&paged=$2 [QSA,L]
  5. RewriteRule ^tag/?(.*)$ /YOURSITE/index.php?tag=$1 [QSA,L]

.htaccess 에다가 위와 같이 추가해주면 된다.
(구글링하다가 본 건데 어디가 출처였는지 기억이 안남-_-)