xml 연동문제좀 봐주세요.ㅠㅠ 정보
xml 연동문제좀 봐주세요.ㅠㅠ
본문
스킨중에 xml 연동 플래쉬ㅏ소스를 이용해서 작업중인데요.
게시판에 글을 쓰거나, 삭제하면 xml_info.xml 이라는 파일이 생성됩니다.
그런데... 문제는 xml_info.xml 을 카피해서
xml_info2.xml , xml_info3.xml 이렇게 2개의 파일이 동일한 내용으로 xml_info.xml 을 카피해야합니다.
왜 그러냐하면, 각각 다른 페이지에서 사이즈가 다른 다른 플래쉬에서 xml_info2,3 xml 파일을 불러와야하기 때문인데요.
방법을 당최 모르겟네요.
fwrite 이용해서 하려고 하는데,안되나요?
아래는 xml_info.xml 을 생성하는 소스입니다.
//////////////////////////////////////////////////
<?
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define("_GNUBOARD_", TRUE);
######################환경변수#########################
$laguage_ = "euc-kr"; //xml 생성파일은 utf-8 로 생성되어야 함.
//$bo_table = 'menu33';
//$write_table = 'menu33';
//개별정보를 사용할경우
//$xml_dir = "../xml_banner/".$bo_table; //
//$xml_path = $xml_dir."/".$bo_table.".xml";
//
//$xml_dir = $g4[path]."/xml_banner/swf"; //
$xml_dir = "../xml_banner/swf"; //
$xml_path = $xml_dir."/".$bo_table."_info.xml";
#######################################################
//디렉토리가 존재하지 않는다면 신규생성한다
@mkdir($xml_dir, 0707);
@chmod($xml_dir, 0707);
//파일이 존재하지 않는다면 신규생성한다.
if(!$xml_path){
fwrite($xml_file, "");
fclose($xml_file);
@chmod($xml_path, 0707);
}
$xml_file = fopen($xml_path, "w+")or die("xml file open error.$bo_table");
/****************빌더갱신영역***********************/
//xml 갱싱
$rows = 10;
//$sql = " select * from $write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
$sql = " select * from $write_table where wr_is_comment = 0 order by wr_hit desc limit 0, $rows ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
/*************빌더갱싱*****************************/
$data[lauage] = "<?xml version=\"1.0\" encoding=\"{$laguage_}\" ?>";
$data[xml_start] = "<file>";
$data[xml_end] = "</file>";
$get_xml = "";
$get_xml .= $data[lauage];
/*xml 생성*/
while ($list= sql_fetch_array($result)){
$get_sql = " select wr_id, bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '{$list[wr_id]}' and bf_no = 0 ";
$img_row = sql_fetch($get_sql);
//이미지가 존재하는경우만
if($img_row[bf_file]){
//$img_path = "$g4[path]/data/file/$bo_table";
//$img_path .= "/".$img_row[bf_file];
//$img_path = "$g4[path]/data/file/$bo_table";
$img_path = "/2009_artmd/data/file/$bo_table";
$img_path .= "/wr_".$img_row[wr_id].".thumb";
$get_xml .= $data[xml_start];
$view_subject = conv_subject($list[wr_subject], 10, "");
$get_xml .= "<title value=\"{$view_subject}\" />";
$get_xml .= "<price value=\"1111\" />";
$get_xml .= "<sale value=\"{$list[wr_name]}\" />";
$get_xml .= "<imgURL value=\"{$img_path}\" />";
$get_xml .= "<linkURL value=\"http://www.artmd.co.kr/2009_artmd/bbs/board.php?bo_table={$bo_table}&wr_id=$img_row[wr_id]\" />";
$get_xml .= $data[xml_end];
}
}
$get_xml .= "<option showNum=\"8\" xImg=\"26\" yImg=\"10\" xSpaceImg=\"10\" imgXsize=\"115\" imgYsize=\"155\" maskMargin=\"5\" />";
/****************************xml data end**************************/
//변환
$get_xml = iconv("EUC-KR", "EUC-KR",$get_xml);
// write action
if(!fwrite($xml_file, $get_xml)) echo "file wite erro.";
// file close
fclose($xml_file);
?>
////////////////////////////////////////////////////
여기서 마지막에 fwrite 나 copy 등의 명렁어로 동일한 내용으로 파일명만 다르게 2개를 복사해주면 됩니다.
무슨 방법이 없을까요? ㅠ 도와주세요.
게시판에 글을 쓰거나, 삭제하면 xml_info.xml 이라는 파일이 생성됩니다.
그런데... 문제는 xml_info.xml 을 카피해서
xml_info2.xml , xml_info3.xml 이렇게 2개의 파일이 동일한 내용으로 xml_info.xml 을 카피해야합니다.
왜 그러냐하면, 각각 다른 페이지에서 사이즈가 다른 다른 플래쉬에서 xml_info2,3 xml 파일을 불러와야하기 때문인데요.
방법을 당최 모르겟네요.
fwrite 이용해서 하려고 하는데,안되나요?
아래는 xml_info.xml 을 생성하는 소스입니다.
//////////////////////////////////////////////////
<?
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
define("_GNUBOARD_", TRUE);
######################환경변수#########################
$laguage_ = "euc-kr"; //xml 생성파일은 utf-8 로 생성되어야 함.
//$bo_table = 'menu33';
//$write_table = 'menu33';
//개별정보를 사용할경우
//$xml_dir = "../xml_banner/".$bo_table; //
//$xml_path = $xml_dir."/".$bo_table.".xml";
//
//$xml_dir = $g4[path]."/xml_banner/swf"; //
$xml_dir = "../xml_banner/swf"; //
$xml_path = $xml_dir."/".$bo_table."_info.xml";
#######################################################
//디렉토리가 존재하지 않는다면 신규생성한다
@mkdir($xml_dir, 0707);
@chmod($xml_dir, 0707);
//파일이 존재하지 않는다면 신규생성한다.
if(!$xml_path){
fwrite($xml_file, "");
fclose($xml_file);
@chmod($xml_path, 0707);
}
$xml_file = fopen($xml_path, "w+")or die("xml file open error.$bo_table");
/****************빌더갱신영역***********************/
//xml 갱싱
$rows = 10;
//$sql = " select * from $write_table where wr_is_comment = 0 order by wr_id desc limit 0, $rows ";
$sql = " select * from $write_table where wr_is_comment = 0 order by wr_hit desc limit 0, $rows ";
$result = sql_query($sql);
$total_count = mysql_num_rows($result);
/*************빌더갱싱*****************************/
$data[lauage] = "<?xml version=\"1.0\" encoding=\"{$laguage_}\" ?>";
$data[xml_start] = "<file>";
$data[xml_end] = "</file>";
$get_xml = "";
$get_xml .= $data[lauage];
/*xml 생성*/
while ($list= sql_fetch_array($result)){
$get_sql = " select wr_id, bf_file from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '{$list[wr_id]}' and bf_no = 0 ";
$img_row = sql_fetch($get_sql);
//이미지가 존재하는경우만
if($img_row[bf_file]){
//$img_path = "$g4[path]/data/file/$bo_table";
//$img_path .= "/".$img_row[bf_file];
//$img_path = "$g4[path]/data/file/$bo_table";
$img_path = "/2009_artmd/data/file/$bo_table";
$img_path .= "/wr_".$img_row[wr_id].".thumb";
$get_xml .= $data[xml_start];
$view_subject = conv_subject($list[wr_subject], 10, "");
$get_xml .= "<title value=\"{$view_subject}\" />";
$get_xml .= "<price value=\"1111\" />";
$get_xml .= "<sale value=\"{$list[wr_name]}\" />";
$get_xml .= "<imgURL value=\"{$img_path}\" />";
$get_xml .= "<linkURL value=\"http://www.artmd.co.kr/2009_artmd/bbs/board.php?bo_table={$bo_table}&wr_id=$img_row[wr_id]\" />";
$get_xml .= $data[xml_end];
}
}
$get_xml .= "<option showNum=\"8\" xImg=\"26\" yImg=\"10\" xSpaceImg=\"10\" imgXsize=\"115\" imgYsize=\"155\" maskMargin=\"5\" />";
/****************************xml data end**************************/
//변환
$get_xml = iconv("EUC-KR", "EUC-KR",$get_xml);
// write action
if(!fwrite($xml_file, $get_xml)) echo "file wite erro.";
// file close
fclose($xml_file);
?>
////////////////////////////////////////////////////
여기서 마지막에 fwrite 나 copy 등의 명렁어로 동일한 내용으로 파일명만 다르게 2개를 복사해주면 됩니다.
무슨 방법이 없을까요? ㅠ 도와주세요.
댓글 전체
맨밑에 fclose($xml_file);
아래에
exec('cp '.$xml_path.' '.$xml_dir.'/'.$bo_table.'_info2.xml');
이렇게 될라는지요?
아래에
exec('cp '.$xml_path.' '.$xml_dir.'/'.$bo_table.'_info2.xml');
이렇게 될라는지요?