Date: 06/09/01
- Next message: Peter Bowyer: "Re: [phplib] Template Problems"
- Previous message: nathan r. hruby: "Re: [phplib] problem..."
- In reply to: Peter Bowyer: "[phplib] Template Problems"
- Next in thread: Peter Bowyer: "Re: [phplib] Template Problems"
- Reply: Peter Bowyer: "Re: [phplib] Template Problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Jun 09, 2001 at 08:10:16AM +0100, Peter Bowyer wrote:
> I have the following code which is supposed to replace a block in my code
> with nothing (ie remove it ;-)) but it doesn't work :-(
>
> Please help, 'cause what I'm doing hinges on getting this to work!
>
> Thanks
> Peter.
> === Start of code ===
> $tpl = new Template(".");
> $tpl->set_file(array("message" => "$template.tpl", "card" => "card.tpl"));
>
> $tpl->set_var("IMAGE", $image);
> [snip]
> $tpl->set_var("MUSIC", $music);
> if ($music == "") {
> $tpl->set_block("message", "music_block");
> $tpl->set_var("music_block", "");
> // $tpl->parse("music_block", "");
> }
Hi,
I'd try something like this:
$tpl->set_file(array("message" => "$template.tpl", "card" => "card.tpl"));
$tpl->set_block("message", "music_block", "music_blocks");
$tpl->set_var("IMAGE", $image);
[snip]
$tpl->set_var("MUSIC", $music);
if ($music != "") {
// Populate the block if you have some music.
$tpl->set_var("var"=>'value");
$tpl->parse("music_blocks", "music_blocks");
}
> $tpl->parse("CONTENT", "message");
> $tpl->pparse("CONTENT", "card");
>From my experiences with templates if you don't give a block a name
it always appears, but if you give a block a name and don't set
any variables in that block it will not appear.
Darryl
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Peter Bowyer: "Re: [phplib] Template Problems"
- Previous message: nathan r. hruby: "Re: [phplib] problem..."
- In reply to: Peter Bowyer: "[phplib] Template Problems"
- Next in thread: Peter Bowyer: "Re: [phplib] Template Problems"
- Reply: Peter Bowyer: "Re: [phplib] Template Problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

