2011-05-12 7 views
1

방금 ​​PEAR 프로그래밍에서 새로 왔습니다. SIGMA 템플릿을 사용하여 데이터베이스에서 html로 데이터를 전달하려고 할 때 문제가 발생했습니다. 여기에 코드 :PEAR 오류 "블록 '카테고리'를 찾을 수 없습니다."

$tpl->loadTemplateFile('content_index_form.html'); 

$csql = "SELECT a.* 
      FROM `dod_cat` a 
      LEFT JOIN `dod_brand` b ON b.sID = a.sID 
      WHERE a.status =1 
      GROUP BY a.sID"; 
    $result_category = $mdb2->query($csql); 
    if (MDB2::isError($result_category)) { 
     die ("Error: ".$result_category->getMessage()." <br>Query:".$csql."<br>"); 
    } 
    $y=0; 
    while($row_category = $result_category->fetchRow()){ 
     $y++; 
     $tpl->setVariable(array(
      'cat_id' => $row_category['sID'], 
      'cat_name' => $row_category['name'], 
      'cat_equ' => $row_category['equ_name'], 

     )); 
     $tpl->parse('categories'); 
    } 

$tpl->show(); 

다음 템플릿 코드 :

<table> 
<!-- BEGIN categories --> 
<tr> 
    <td><a href="{cat_id}">{cat_name}&nbsp;({cat_equ})</a></td> 
</tr> 
<!-- BEGIN categories --> 
</table> 

는 그리고이 오류 라인 인 HTML 페이지에 쇼 '블록'카테고리 '를 찾을 수 없습니다. " 누군가 내 코드의 문제점을 알고 있습니까?

END categories 

이 아닌 두 사람은 시작에

+0

'content_index_form.html'의 내용을 게시하십시오. –

+0

@Sander : content_index_form.html에 내용을 구문 분석하는 기능을 알고 있습니다. 하지만 위에서 말한 것처럼 오류가 발생했습니다. 왜? – Gaptek

+0

이유를 모르겠습니다. 아마도 템플릿에'categories' 블록이 없기 때문일 것입니다. 오류와 마찬가지로 말입니다. 그래서 우리가 확인할 수 있도록'content_index_form.html' 템플릿 파일의 내용을 게시하십시오. –

답변

0

당신이 필요합니다.

+0

세상에, 내 어리 석음이야 ... 고마워 .cweiske :) – Gaptek

관련 문제