[phplib] templates and SETBLOCK From: Hyun Jo (hyun <email protected>)
Date: 12/06/00

I figured out how to use the template class in phplib, but I have one
problem. When using the set_block function to print out a result set from a
DB query, and the query returns 0 results, the script spits out the handler
name in the output and messes up my formatting--even though i set unknowns
to "remove". How do i make it so that the block doesn't even print if
there's no data?

the code:

$tmpl->set_block("main", "item_row", "item_rows");

  ## Traverse the result set
  $db->query($result_query);

  while ($db->next_record()){

    $tmpl->set_var(array( "form_action" => $sess->self_url(),
                          "products_id" => $db->f("products_id"),
                          "products_name" => $db->f("products_name"),
                          "products_model" => $db->f("products_model"),
                          "products_price" => $db->f("products_price"),
                          "products_categories" => $products_categories ));

    $tmpl->parse("item_rows", "item_row", true);

  }

any help would be greatly appreciated

Hyun Jo

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>