Date: 10/16/00
- Next message: davelists <email protected>: "[phplib] Oracle support using OCI8 functions"
- Previous message: Daniel Bondurant: "[phplib] hidding template blocks"
- In reply to: Daniel Bondurant: "[phplib] hidding template blocks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I've done that myself, bmaybe I can help you.
You should set the entire text with the error message in a block:
file: template.ihtml:
....
<!-- BEGIN error -->
An error occured. Click <a href="javascript: history.go(-1);">here</a> to go
back.
<!-- END error -->
....
file program.php:
....
$t = new Template(...);
$t->set_file("main", "template.ihtml");
...
Now, if the error occurs you should say:
$t->set_block("main", "error");
and than the error is displayed!
If the error does NOT occur, you say:
$t->set_block("main", "error");
$t->set_var("error", "");
and the error block is set and the created handle "error" will be set empty.
The error will not be displayed.
The ultimate way is to put this into local.inc:
class My_Template extends Template {
function My_Template() {
// fixed path, configure one time.
$this->Template("/path/to/templates", "keep");
}
function del_block($container, $handle);
$this->set_block($container, $handle);
$this->set_var($handle, "");
}
}
then you can say:
$t->del_block("main", "error");
instead of the two lines mentioned before.
brian
----- Original Message -----
From: Daniel Bondurant <bondu <email protected>>
To: <phplib <email protected>>
Sent: Sunday, October 15, 2000 10:21 PM
Subject: [phplib] hidding template blocks
> I am using phplib templates, and I need to set up an error block in a
table.
> I only want to parse the block if there is an error, but I can't figure
out
> how to hide it if there is none.
>
> I have Templates set to "remove," and it hides the error message, but not
> the entire block.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> For additional commands, e-mail: phplib-help <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: davelists <email protected>: "[phplib] Oracle support using OCI8 functions"
- Previous message: Daniel Bondurant: "[phplib] hidding template blocks"
- In reply to: Daniel Bondurant: "[phplib] hidding template blocks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

