묻고답하기

* 해당 내용은 게시판 스킨에서 read.html or read_document.html 에 해당하는 내용입니다.




1번 게시판에서


2번 게시판의 정보를 불러오고 싶습니다.



단순히 불러오는 것이 아니라


확장변수 조건에 맞는 경우 불러오게 하고 싶습니다.



즉 2번 게시판의 root라는 확장변수 값이 apple인 게시물을 불러오는 것이지요..



우선 해당 기능은 구현하긴 했습니다만...(잘되긴 합니다.)


뭐랄까... 너무 여러번 쿼리를 날리는 것 같아서... 이래도 되는 건지...


선구자분들의 의견을 듣고 싶습니다.


문제가 없으면 상관 없을텐데.. 아무튼... 해당 코드를 다듬을 수 있는지 궁금합니다.


$prd->getExtraEidValueHTML('확장변수ID');


이런식으로 사용하는 건 안되더군요..-_-;;



가장 좋은 방법은.. $document_list처럼 다른 게시판 정보를 출력할 것을 담을 수 있다면


가장 베스트이지 않을까.. 합니다만..


해당 방법을 모르겠군요..ㅡ.ㅜ.


고견 부탁드립니다.





{@
			//대상 게시판 mid
			$parent_mid = 'test';

			$oDB = &DB::getInstance();
			$query = $oDB->_query('select module_srl from xe_modules where mid="'.$parent_mid.'"');
			$module = $oDB->_fetch($query);

			//게시판 srl값
			$module_srl = $module->module_srl;

			//타겟 eid(확장변수id)
			$target_eid = 'root';

			// 뽑아올 확장변수 값의 기준..
			$target_id = 'apple';

			$oDB = &DB::getInstance();
			// 확장변수에서 모듈값, 확장변수 id, 확장변수 값 비교해서 가져오기
			$query = $oDB->_query('select document_srl from xe_document_extra_vars where module_srl="'.$module_srl.'" and eid="'.$target_eid.'" and value="'.$target_id.'"');
			// 가져온 값을 target_document로 저장
			$target_document = $oDB->_fetch($query);

		}

		<!-- target_document를 출력하기 위해 뿌림 -->

		<!--@foreach($target_document as $document_srl => $cont)-->
		{@
			$oDB = &DB::getInstance();
			// 게시판 문서 정보를 가져옴
			$query = $oDB->_query('select * from xe_documents where document_srl="'.$cont->document_srl.'"');
			$prd = $oDB->_fetch($query);

			// 확장변수 cv의 값을 가져옴
			$query = $oDB->_query('select value from xe_document_extra_vars where document_srl="'.$cont->document_srl.'" and eid="cv"');
			$cv = $oDB->_fetch($query);
			$cv = $cv->value;

			// 확장변수 thumb 값을 가져옴
			$query = $oDB->_query('select value from xe_document_extra_vars where document_srl="'.$cont->document_srl.'" and eid="thumb"');
			$thumb = $oDB->_fetch($query);
			$thumb = $thumb->value;

			// 확장변수 cvlink 값을 가져옴
			$query = $oDB->_query('select value from xe_document_extra_vars where document_srl="'.$cont->document_srl.'" and eid="cvlink"');					$cvlink = $oDB->_fetch($query);
			$cvlink = $cvlink->value;

			// cvlink값이 있으면 cv를 링크로 감싸줌
			if($cvlink)	$cv = '<a href="'.$cvlink.'" />'.$cv.'</a>';
		}

		<div class="list">
			<p>
				<img src="{$thumb}" />
			</p>
			<p>{$prd->title} ({$cv})</p>
			<p>{$prd->content}</p>
		</div>
		<!--@end-->




조금 소스를 줄여봤습니다..


foreach를 이용해서~ if으로 처리했는데.. 역시 이것도 뭐랄까 깔끔하다는 느낌은 나지 않네요..ㅡ.ㅜ



{@
			//대상 게시판 mid
			$parent_mid = 'test';

			$oDB = &DB::getInstance();
			$query = $oDB->_query('select module_srl from xe_modules where mid="'.$parent_mid.'"');
			$module = $oDB->_fetch($query);

			//게시판 srl값
			$module_srl = $module->module_srl;

			//타겟 eid(확장변수id)
			$target_eid = 'root';

			// 뽑아올 확장변수 값의 기준..
			$target_id = 'apple';

			$oDB = &DB::getInstance();
			// 확장변수에서 모듈값, 확장변수 id, 확장변수 값 비교해서 가져오기
			$query = $oDB->_query('select document_srl from xe_document_extra_vars where module_srl="'.$module_srl.'" and eid="'.$target_eid.'" and value="'.$target_id.'"');
			// 가져온 값을 target_document로 저장
			$target_document = $oDB->_fetch($query);

		}

		<!-- target_document를 출력하기 위해 뿌림 -->

		<!--@foreach($target_document as $document_srl => $cont)-->
		{@
			$oDB = &DB::getInstance();
			$query = $oDB->_query('select * from xe_documents where document_srl="'.$cont->document_srl.'"');
			$prd = $oDB->_fetch($query);

			$query = $oDB->_query('select value, eid from xe_document_extra_vars where document_srl="'.$cont->document_srl.'"');
			//해당 게시판의 확장변수를 가져옴
			$extra = $oDB->_fetch($query);
		}

		<!-- foreach로 반복으로 돌려서~ -->
		<!--@foreach($extra as $eid => $exvar)-->

			<!-- 원하는 값을 매칭해서 변수로 저장~ -->
			<!--@if($exvar->eid=='cv')-->
				{@ $cv = $exvar->value; }
			<!--@else if($exvar->eid=='cvlink')-->
				{@
					$cvlink = $exvar->value;
					$cv = '<a href="'.$cvlink.'" />'.$cv.'</a>';
				}
			<!--@else if($exvar->eid=='thumb')-->
				{@ $thumb = $exvar->value; }
			<!--@else-->

			<!--@end-->
		<!--@end-->

		<div class="list">
			<p>
				<img src="{$thumb}" />
			</p>
			<p>{$prd->title} ({$cv})</p>
			<p>{$prd->content}</p>
		</div>
		<!--@end-->

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
김지만 한 화면 전체를 어떻게 배경으로??  
김혜성 하나포스 무료계정 광고창 않뜨게 하는 방법좀 부탁합니다.제발요..  
김혜성 하나포스 무료계정 광고창 뜨는거 없애는 소스좀 갈켜주세요..  
쟈니K 특정 자바스크립트 무력화 시키는 방법좀 알려주세요.  
지우개 바네이 메뉴라고 불리우는 자바스크립을 찾고있는데요.... [1] 2007.08.10
justrue iframe 에서 링크 문제입니다. 급해요 ㅠ.ㅠ [2] 2007.08.10
조영인 롤오버 문제입니다. 해결부탁드립니다. [2] 2007.08.10
로크 팝업창  
박상철 sanmg.com 으로 (가비아호스팅 ) 이란 회사를 통해 구입했습니다. 이것을 집에있는 서버에서 사용하기위해서는? [1] 2007.08.10
∑『㈜SH™』 form 값을 합치는 방법은?;; [3] 2007.08.10
안영숙 이미지맵을 사용하면 여백이 생겨요. [2] 2007.08.10
권혜경 이렇게 이미지 볼수 있는 방법이 없을가요? [1] 2007.08.10
조영인 테이블 질문좀요...  
마일 사운드포지 메뉴얼 어디서 구할수있죠?  
Budge.V 명암에 대해서 질문좀 할께요...  
조영인 인클루드 질문좀 [2] 2007.08.10
sometime 플래쉬 삽입에서 autoplay 체크  
gongsn 음원소스 루프 부드럽게 어떻게 하나요? [1] 2007.08.10
백무혼 asp의 Application을 php대처할수있는게없을까요?  
저녁노을 이것좀 고쳐주세요 ..^^ [1] 2007.08.10
정재수 81번 포트 [1] 2007.08.10
Ruviana 요즘 소설 홈페이지 사용되는 "문고판" 모드를 만들수 없나요?  
최난새 (질문)제로보드 최근게시물에서,새창띠우기  
나르미스 비베에서 left, right 같은함수가 몬가요?..(php용) [1] 2007.08.10
오지영 밑줄....어케지우죠;? [2] 2007.08.10
Ken 이런식의 슬라이딩 메뉴 어떻게 하죠?  
K-POP ★★★ 포토샵에서 인물이랑 배경이랑 합성할때 ★★★ [1] 2007.08.10
윤수리 프레임내의 HTML문서로 바로 이동하기??  
정병환 이런 홈페이지를 만들고 싶은데요.. [3] 2007.08.10
-G.W- 포토샵에서 36-40포인트로 깨끝하게 나오는 폰트가 있을가요? [3] 2007.08.10