开发者

PEAR error "Cannot Find Block 'categories' "

开发者 https://www.devze.com 2023-03-05 19:44 出处:网络
I just new in PEAR programming. I got a problem when try to passing data from database to html with SIGMA templating. Here the code :

I just new in PEAR programming. I got a problem when try to passing data from database to html with SIGMA templating. Here the code :

$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();

Below is template code:

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

And this is the error line "Cannot find block 'categories'" show on html page. Is it anybody know what the probl开发者_运维技巧em of my code?


You need to

END categories

not two begins.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号