Robert Mudryk
|
| Posted: 04/08/2002, 5:58 PM |
|
Using PHP4 & Templates:
I want to hide a form if it's a empty dataset... is there a more elegant
way than editing the "Process empty Recordset" section of the php and
adding $tpl->set_var("FormFormName",""); to the end of this section.
I'd prefer to be able to generate the code without having to manually
edit it after each generation
//-------------------------------
// Process empty recordset
//-------------------------------
if(!$next_record)
{
$tpl->set_var("FormTodaysSpecials","");
$tpl->set_var("DListTodaysSpecials", "");
$tpl->parse("TodaysSpecialsNoRecords", false);
$tpl->set_var("TodaysSpecialsNavigator", "");
$tpl->parse("FormTodaysSpecials", false);
$tpl->set_var("FormTodaysSpecials","");
return;
}
//-------------------------------
|
|
|
 |
Alexey Alexapolsky
|
| Posted: 04/09/2002, 3:01 AM |
|
You can check if no records were found in Form/Open event by counting
records and
it's true, call something like. Count sql can be obtained from sSQL variable
by replacing a string
between SELECT and FROM keywords with "count(*)"
$tpl->set_var("FormItems","");
return;
in the same event
--
Alex
CodeCharge Developer
"Robert Mudryk" <rob@lasers.org> wrote in message
news:3CB23CC3.8E2A1E0F@lasers.org...
> Using PHP4 & Templates:
>
> I want to hide a form if it's a empty dataset... is there a more elegant
> way than editing the "Process empty Recordset" section of the php and
> adding $tpl->set_var("FormFormName",""); to the end of this section.
>
> I'd prefer to be able to generate the code without having to manually
> edit it after each generation
>
> file://-------------------------------
> // Process empty recordset
> file://-------------------------------
> if(!$next_record)
> {
> $tpl->set_var("FormTodaysSpecials","");
> $tpl->set_var("DListTodaysSpecials", "");
> $tpl->parse("TodaysSpecialsNoRecords", false);
> $tpl->set_var("TodaysSpecialsNavigator", "");
> $tpl->parse("FormTodaysSpecials", false);
> $tpl->set_var("FormTodaysSpecials","");
> return;
> }
> file://-------------------------------
>
>
>
|
|
|
 |
|