Date: 03/30/00
- Next message: kir: "[PHPLIB-DEV] cvs commit"
- Previous message: teo <email protected>: "PHP Templates (was: Re: [PHPLIB-DEV] cvs commit)"
- In reply to: Kirill Maximov: "Re: [PHPLIB-DEV] cvs commit"
- Next in thread: kir: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Kirill Maximov wrote:
> Kristian KÃhntopp wrote:
> > If you want to have conditional replacement of {PLACEHOLDER},
> > set_var("PLACEHOLDER", ""); Anything programmatic does not
> > belong into a template, but into your code.
> >
> It gives bad result when EMAIL empty. What I did is:
>
> <TR BGCOLOR="white" ALIGN=LEFT><TH>Name</TH><TD>{NAME}</TD>
> <BEGIN email_if IF {email_test} -->
> <TR BGCOLOR="white" ALIGN=LEFT><TH>Email</TH><TD><FONT
> color="red">{EMAIL}</FONT></TD>
> <END email_if -->
> <BEGIN fax_if IF {fax_test} -->
> <TR BGCOLOR="white" ALIGN=LEFT><TH>Fax</TH><TD>{FAX}</TD>
> <END fax_if -->
In this example, you could make this a block
<TR BGCOLOR="white" ALIGN=LEFT><TH>Name</TH><TD>{NAME}</TD>
<!-- BEGIN bk_email -->
<TR BGCOLOR="white" ALIGN=LEFT><TH>Email</TH><TD><FONT color="red">{EMAIL}</FONT></TD>
<!-- END bk_email -->
<!-- BEGIN bk_fax -->
<TR BGCOLOR="white" ALIGN=LEFT><TH>Fax</TH><TD>{FAX}</TD>
<!-- END bk_fax -->
set_block this and zap it on demand. Logic does not belong
into Templates. It does belong into PHP.
You are able to construct examples where Template as it is now
breaks down. In this case you should ask youself if it is worth
to change Template to accomodate that case - in most cases it is
not, but Template is just the wrong tool for that job.
Kristian
-- Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00 Using PHP3? See our web development library at http://phplib.netuse.de/ (We have moved! Update your bookmarks!) - PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>. To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in the body, not the subject, of your message.
- Next message: kir: "[PHPLIB-DEV] cvs commit"
- Previous message: teo <email protected>: "PHP Templates (was: Re: [PHPLIB-DEV] cvs commit)"
- In reply to: Kirill Maximov: "Re: [PHPLIB-DEV] cvs commit"
- Next in thread: kir: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

