사용자 함수 추가 정보
사용자 함수 추가관련링크
http://des.samcheok.ac.kr
214회 연결
본문
<?
if (!defined('_GNUBOARD_')) exit;
function count_latest($bo_table)
{
global $latest_skin, $cfg;
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
//오늘 날짜 0시의 time Stamp를 구한다.
$today_stamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
$today_str = date("Y-m-d H:i:s", $today_stamp);
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0 and wr_datetime > '$today_str'";
$result = sql_query($sql);
$count = mysql_num_rows($result);
if($count !=0)
echo " <font color=red size=1>[$count]</font>";
mysql_free_result($result);
}
?>
이런 함수가 있습니다.
사용법은
<a href="<?=$g4[bbs_path]?>/board.php?bo_table=qa">질문과 답변</a><?=count_latest("qa");?>입니다.
이걸 extend/count_latest.php로 해서 저장을 했습니다.
그런데
Warning: Cannot modify header information - headers already sent by (output started at extend/count_latest.php:12) in /gnu4/head.sub.php on line 44
라는 에러가 뜹니다.
뭐를 수정해야 하는거죠?
if (!defined('_GNUBOARD_')) exit;
function count_latest($bo_table)
{
global $latest_skin, $cfg;
$sql = " select * from $cfg[table_board] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
//오늘 날짜 0시의 time Stamp를 구한다.
$today_stamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
$today_str = date("Y-m-d H:i:s", $today_stamp);
$sql = " select *
from {$cfg[write_table_prefix]}{$bo_table}
where wr_comment = 0 and wr_datetime > '$today_str'";
$result = sql_query($sql);
$count = mysql_num_rows($result);
if($count !=0)
echo " <font color=red size=1>[$count]</font>";
mysql_free_result($result);
}
?>
이런 함수가 있습니다.
사용법은
<a href="<?=$g4[bbs_path]?>/board.php?bo_table=qa">질문과 답변</a><?=count_latest("qa");?>입니다.
이걸 extend/count_latest.php로 해서 저장을 했습니다.
그런데
Warning: Cannot modify header information - headers already sent by (output started at extend/count_latest.php:12) in /gnu4/head.sub.php on line 44
라는 에러가 뜹니다.
뭐를 수정해야 하는거죠?
댓글 전체
혹시 사용하시는곳 php 파일에서 extend/count_latest.php를 인클루드 하셨나요?
하셨다면 제거하십시오.
extend 디렉토리에있는 파일들은 common.php에서 자동으로 인클루드하므로 사용하는 파일상단에서 인클루드 하시면 안됩니다.
하셨다면 제거하십시오.
extend 디렉토리에있는 파일들은 common.php에서 자동으로 인클루드하므로 사용하는 파일상단에서 인클루드 하시면 안됩니다.
그런건 전혀 손댄곳 없습니다.
일단 정확한 문제는 모르겠지만... 함수가 g4용이 아니네요...
g4용이라면 이렇게 되어야 할 듯 합니다.
글리고 <? ?> 바깥의 모든 공백(엔터,탭,스페이스 등등)을 제거하세요
<?
if (!defined('_GNUBOARD_')) exit;
function count_latest($bo_table)
{
global $latest_skin, $g4;
$sql = " select * from $g4[board_table] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
//오늘 날짜 0시의 time Stamp를 구한다.
$today_stamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
$today_str = date("Y-m-d H:i:s", $today_stamp);
$sql = " select *
from {$g4[write_prefix]}{$bo_table}
where wr_is_comment = 0 and wr_datetime > '$today_str'";
$result = sql_query($sql);
$count = mysql_num_rows($result);
if($count !=0)
echo " <font color=red size=1>[$count]</font>";
mysql_free_result($result);
}
?>
g4용이라면 이렇게 되어야 할 듯 합니다.
글리고 <? ?> 바깥의 모든 공백(엔터,탭,스페이스 등등)을 제거하세요
<?
if (!defined('_GNUBOARD_')) exit;
function count_latest($bo_table)
{
global $latest_skin, $g4;
$sql = " select * from $g4[board_table] where bo_table = '$bo_table' ";
$bo = sql_fetch($sql);
$bo_subject = $bo[bo_subject];
//오늘 날짜 0시의 time Stamp를 구한다.
$today_stamp = mktime(0,0,0, date('m'), date('d'), date('Y'));
$today_str = date("Y-m-d H:i:s", $today_stamp);
$sql = " select *
from {$g4[write_prefix]}{$bo_table}
where wr_is_comment = 0 and wr_datetime > '$today_str'";
$result = sql_query($sql);
$count = mysql_num_rows($result);
if($count !=0)
echo " <font color=red size=1>[$count]</font>";
mysql_free_result($result);
}
?>
잘 됩니다. 고맙습니다 ^^;;