2011-10-27 2 views
1

포드를 사용하여 항목을 만듭니다. 포드를 통해 관계가 무엇인지에 따라 필터링하고 싶습니다.포드 findRecords 관계

예 : 나는에서 선택하는이 개 관계를 가지고 :

$pods_name = "attitude"; 
//get the specific pod object: 
$thePod = new Pod($pods_name); 
$thePod->findRecords(-1, "attitude.mood = Good"); 
//mood is the label of the relationship you can choose from (has 
//the options between good or bad) 

이의 문제는 그것이 좋고 나쁜 모두에서 항목을 반환하는 것입니다 "좋은"또는 "나쁜". 데이터베이스에 연결되어있는 것을 볼 수 없지만 "Good"아래에 나열된 항목의 레코드 만 찾으려면 더 구체적인 방법이 있습니까?

답변

3

findRecords는 MySQL 쿼리를 사용하므로 좋은 텍스트를 따옴표로 묶어야합니다. 또한

$thePod->findRecords(array('orderby' => 't.name', 'limit' => -1, 'where' => 'attitude.mood = "Good"')); 

: 나는 $의 PARAMS 방법을 사용하는 것이 좋습니다 있지만

$thePod->findRecords('t.name', -1, 'attitude.mood = "Good"'); 

: http://podscms.org/codex/findrecords/

당신은 가능성이 코드를 사용 찾고 있습니다 : 또한

는 문서에서 사용 팔로우 findRecords에 뭔가를 넣기 전에 (사용자 입력), findRecords에 넣기 전에 esc_sql ($ value)을 실행해야합니다.