최신글 리스트에서 데이터를 뽑아와 글을 출력했는데요 띄어쓰기가
본문
최신글 리스트에서 데이터를 뽑아와 글을 출력했는데요 띄어쓰가 전혀 안되어 나오네요
코드는 아래와 같습니다.
왜 그런 것일까요? 한 수 부탁드립니다. 꾸벅^^__^^;
<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td valign="top">
<ul>
<? for ($i=0; $i<$rows; $i++) { ?>
<? if (function_exists('bc_code')) { $list[$i][subject] = bc_code($list[$i][wr_subject]); }?>
<li class='comment'><a href="<?=$list[$i][href]?>" target="_top"><?=cut_str($list[$i][subject], $subject_len)?></a>
<span class='comment'><?=$list[$i][wr_comment]?'+'.$list[$i][wr_comment]:''?></li>
<? } ?>
</ul>
</td>
</tr>
</table>
<tr>
<td valign="top">
<ul>
<? for ($i=0; $i<$rows; $i++) { ?>
<? if (function_exists('bc_code')) { $list[$i][subject] = bc_code($list[$i][wr_subject]); }?>
<li class='comment'><a href="<?=$list[$i][href]?>" target="_top"><?=cut_str($list[$i][subject], $subject_len)?></a>
<span class='comment'><?=$list[$i][wr_comment]?'+'.$list[$i][wr_comment]:''?></li>
<? } ?>
</ul>
</td>
</tr>
</table>
답변 2
bc_code 라는 함수에서 먼가 한 것같은데 ^^
이 함수를 알아야지 도와드리지요 ㅎㅎ
이궁 빼먹었네요. 고럼~ 한 수 부탁^^__^^;
function bc_code($str, $is_content=1, $only_admin=0) {
global $g4, $bo_table, $wr_id, $board_skin_path;
if ($is_content) {
$str = preg_replace("/\[url:\/\/(.*)\](.*)\[\/url\]/iU", "<a href='http://$1' target='_blank'>$2</a>", $str);
$str = preg_replace("/\[s\](.*)\[\/s\]/iU", "<s>$1</s>", $str);
$str = preg_replace("/\[b\](.*)\[\/b\]/iU", "<b>$1</b>", $str);
$str = preg_replace("/\[u\](.*)\[\/u\]/iU", "<u>$1</u>", $str);
$str = preg_replace("/\[(h[1-9])\](.*)\[\/h[1-9]\]/iU", "<$1>$2</$1>", $str);
$str = preg_replace("/\[file([0-9])\](.*)\[\/file[0-9]\]/iU", "<img src=\"$board_skin_path/img/icon_file_down.gif\" align=absmiddle> <span style='cursor:pointer; text-decoration:underline;' onclick=\"file_download('$g4[bbs_path]/download.php?bo_table=$bo_table&wr_id=$wr_id&no=$1', '', '$1');\">$2</span>", $str);
$str = preg_replace("/\[red\](.*)\[\/red\]/iU", "<span style='color:#ff0000;'>$1</span>", $str);
$str = preg_replace("/\[link([1-2])\](.*)\[\/link[1-2]\]/iU", "<a href=\"$g4[bbs_path]/link.php?bo_table=$bo_table&wr_id=$wr_id&no=$1\" target=\"_blank\">$2</a>", $str);
$str = preg_replace("/\[(\/\/[^\s]+)\s+([^\]]+)\]/iUs", "<a href=\"$1\" target=\"_blank\">$2</a>", $str);
global $write, $config, $row;
if ($write && $write[mb_id] == $config[cf_admin] && !$row[wr_is_comment]) {
$callback = create_function ('$arg', '
global $g4;
if (strstr($_SERVER[PHP_SELF], "plugin/mobile"))
$arg[1] = preg_replace("/^\.\.\//", "../../", $arg[1]);
$content = $arg[0];
if (file_exists($arg[1])) {
ob_start();
include($arg[1]);
$content = ob_get_contents();
ob_end_clean();
}
return $content;'
);
$str = preg_replace_callback("/include\(\"([^\"]+)\"\)/i", $callback, $str);
}
}
global $g4, $bo_table, $wr_id, $board_skin_path;
if ($is_content) {
$str = preg_replace("/\[url:\/\/(.*)\](.*)\[\/url\]/iU", "<a href='http://$1' target='_blank'>$2</a>", $str);
$str = preg_replace("/\[s\](.*)\[\/s\]/iU", "<s>$1</s>", $str);
$str = preg_replace("/\[b\](.*)\[\/b\]/iU", "<b>$1</b>", $str);
$str = preg_replace("/\[u\](.*)\[\/u\]/iU", "<u>$1</u>", $str);
$str = preg_replace("/\[(h[1-9])\](.*)\[\/h[1-9]\]/iU", "<$1>$2</$1>", $str);
$str = preg_replace("/\[file([0-9])\](.*)\[\/file[0-9]\]/iU", "<img src=\"$board_skin_path/img/icon_file_down.gif\" align=absmiddle> <span style='cursor:pointer; text-decoration:underline;' onclick=\"file_download('$g4[bbs_path]/download.php?bo_table=$bo_table&wr_id=$wr_id&no=$1', '', '$1');\">$2</span>", $str);
$str = preg_replace("/\[red\](.*)\[\/red\]/iU", "<span style='color:#ff0000;'>$1</span>", $str);
$str = preg_replace("/\[link([1-2])\](.*)\[\/link[1-2]\]/iU", "<a href=\"$g4[bbs_path]/link.php?bo_table=$bo_table&wr_id=$wr_id&no=$1\" target=\"_blank\">$2</a>", $str);
$str = preg_replace("/\[(\/\/[^\s]+)\s+([^\]]+)\]/iUs", "<a href=\"$1\" target=\"_blank\">$2</a>", $str);
global $write, $config, $row;
if ($write && $write[mb_id] == $config[cf_admin] && !$row[wr_is_comment]) {
$callback = create_function ('$arg', '
global $g4;
if (strstr($_SERVER[PHP_SELF], "plugin/mobile"))
$arg[1] = preg_replace("/^\.\.\//", "../../", $arg[1]);
$content = $arg[0];
if (file_exists($arg[1])) {
ob_start();
include($arg[1]);
$content = ob_get_contents();
ob_end_clean();
}
return $content;'
);
$str = preg_replace_callback("/include\(\"([^\"]+)\"\)/i", $callback, $str);
}
}
답변을 작성하시기 전에 로그인 해주세요.