최신글 뽑아오기에서 태그 없애기 안됨 ㅠ.ㅠ 정보
그누보드 최신글 뽑아오기에서 태그 없애기 안됨 ㅠ.ㅠ첨부파일
본문
김선일씨 끝내 피살 [06-23]
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD class=title height=60><SPAN id… more
이런식으로 나오네요..
태그좀 없애고 싶어요 절대로 안되네요
이것도 안되고
<?
$wr_content = strip_tags($list[$i][content]);
$wr_content = get_text(cut_str($wr_content, 2000, '..........'));
이것도 안됨
<?
$wr_content = cut_str(strip_tags($list[$i][commentcnt], "<style>"),2000,"…");
$wr_content = conv_content($wr_content, 1);
$wr_content = get_text($wr_content);
?>
방법좀 알켜주세요
?>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TBODY> <TR> <TD class=title height=60><SPAN id… more
이런식으로 나오네요..
태그좀 없애고 싶어요 절대로 안되네요
이것도 안되고
<?
$wr_content = strip_tags($list[$i][content]);
$wr_content = get_text(cut_str($wr_content, 2000, '..........'));
이것도 안됨
<?
$wr_content = cut_str(strip_tags($list[$i][commentcnt], "<style>"),2000,"…");
$wr_content = conv_content($wr_content, 1);
$wr_content = get_text($wr_content);
?>
방법좀 알켜주세요
?>
댓글 전체
저 소스를 대입하면 에러가 나옴 어떻게 하라는 거죠?
다음을 참고하세요.
// HTML 특수문자를 변환
String.prototype.htmlChars = function () {
var str = ((this.replace('"', '&')).replace('"', '"')).replace('\'', ''');
return (str.replace('<', '<')).replace('>', '>');
}
// 좌우 공백없애는 함수
String.prototype.trim = function () { return this.replace(/(^s*)|(s*$)/g, ""); }
// 왼쪽 공백없애는 함수
String.prototype.ltrim = function () { return this.replace(/^s*/g, ""); }
// 오른쪽 공백없애는 함수
String.prototype.rtrim = function () { return this.replace(/s*$/g, ""); }
// 태그만 제거
String.prototype.stripTags = function () {
var str = this;
var pos1 = str.indexOf('<');
if (pos1 == -1) return str;
else {
var pos2 = str.indexOf('>', pos1);
if (pos2 == -1) return str;
return (str.substr(0, pos1) + str.substr(pos2+1)).stripTags();
}
}
// 대소문자 구별하지 않고 단어 위치 찾기
String.prototype.ipos = function (needle, offset) {
var offset = (typeof offset == "number")?offset:0;
var pos1 = str.toLowerCase().indexOf(needle.toLowerCase(), offset);
var pos2 = str.toUpperCase().indexOf(needle.toUpperCase(), offset);
if (pos1 == -1 && pos2 == -1) return false;
if (pos1 == -1) pos1 = str.length + 1;
if (pos2 == -1) pos2 = str.length + 1;
return Math.min(pos1, pos2);
}
// 대소문자 구별하지 않고 뒤에서부터 단어위치 찾기
String.prototype.ripos = function (needle, offset) {
var offset = (typeof offset == "number")?offset:0;
var pos1 = str.toLowerCase().lastIndexOf(needle.toLowerCase(), offset);
var pos2 = str.toUpperCase().lastIndexOf(needle.toUpperCase(), offset);
if (pos1 == -1 && pos2 == -1) return false;
return Math.max(pos1, pos2);
}
// 문자열을 배열로
String.prototype.toArray = function () {
var len = this.length;
var arr = new Array;
for (var i=0; i<len; i++) arr[i] = this.charAt(i);
return arr;
}
// HTML 특수문자를 변환
String.prototype.htmlChars = function () {
var str = ((this.replace('"', '&')).replace('"', '"')).replace('\'', ''');
return (str.replace('<', '<')).replace('>', '>');
}
// 좌우 공백없애는 함수
String.prototype.trim = function () { return this.replace(/(^s*)|(s*$)/g, ""); }
// 왼쪽 공백없애는 함수
String.prototype.ltrim = function () { return this.replace(/^s*/g, ""); }
// 오른쪽 공백없애는 함수
String.prototype.rtrim = function () { return this.replace(/s*$/g, ""); }
// 태그만 제거
String.prototype.stripTags = function () {
var str = this;
var pos1 = str.indexOf('<');
if (pos1 == -1) return str;
else {
var pos2 = str.indexOf('>', pos1);
if (pos2 == -1) return str;
return (str.substr(0, pos1) + str.substr(pos2+1)).stripTags();
}
}
// 대소문자 구별하지 않고 단어 위치 찾기
String.prototype.ipos = function (needle, offset) {
var offset = (typeof offset == "number")?offset:0;
var pos1 = str.toLowerCase().indexOf(needle.toLowerCase(), offset);
var pos2 = str.toUpperCase().indexOf(needle.toUpperCase(), offset);
if (pos1 == -1 && pos2 == -1) return false;
if (pos1 == -1) pos1 = str.length + 1;
if (pos2 == -1) pos2 = str.length + 1;
return Math.min(pos1, pos2);
}
// 대소문자 구별하지 않고 뒤에서부터 단어위치 찾기
String.prototype.ripos = function (needle, offset) {
var offset = (typeof offset == "number")?offset:0;
var pos1 = str.toLowerCase().lastIndexOf(needle.toLowerCase(), offset);
var pos2 = str.toUpperCase().lastIndexOf(needle.toUpperCase(), offset);
if (pos1 == -1 && pos2 == -1) return false;
return Math.max(pos1, pos2);
}
// 문자열을 배열로
String.prototype.toArray = function () {
var len = this.length;
var arr = new Array;
for (var i=0; i<len; i++) arr[i] = this.charAt(i);
return arr;
}