Re: [phplib-dev] Template: Patches, incompatibility, etc From: Kirill Maximov (kir <email protected>)
Date: 06/28/00

 hi,

  I suppose that any conditional statements will never appear in
  PHPLIB's standard template class. Programming should go to PHP,
  not to templates (C) kk ;-)
 
  If you need conditions in templates, you can define several
  blocks in your template and remove not needed blocks:

$t->set_block("page", "found_dealer", "found_dealer_block" );

// We don't need block "found_dealer" in template:
$t->set_var("found_dealer_block", "");
$t->get_var("found_dealer");

Zakaria wrote:
>
> Assalamu'alaikum wr. wb.
>
> Hi,
>
> I want to add a feature and fix some code in template.inc,
> I already download the latest cvs (thru cvsweb) and already
> made my patches. Is it OK to send it here? or where?
>
> Basically I want to add preprocessing tag
> <!--IF var-->....<!--ELSE var-->...<!--ENDIF var-->
> and have it processed like cpp process C #ifdef var
>
> This is very usefull for the var that could be empty.
> for example:
> <!--IF ERR_MSG--><b>The following error has happen: {ERR_MSG}
> </b><!--ENDIF ERR_MSG-->
>
> Or to prevent netscape blank cell "bug"
> <td><!--IF STR_VALUE-->{STR_VALUE}<!--ELSE STR_VALUE-->&nbsp;
> <!--ENDIF STR_VALUE--></td>
>
> Another note is the way CVS version handle block.
> It may introduce some incompatibility with the previous version.
>
> In previous version (7.2b) the block is grep from the parent
> and substituted with {var} when you do set_block.
> That way we could have replace the block with empty string
> by not parsing the block and set the var to ''
>
> In the CVS version the block is grep and substituted with {var}
> from the parent when you do get_var("block") or parse the block.
> This way the previous method of getting empty block is void
> the alternative way maybe (I haven't try it) is to get_var("block")
> and set the var to '' or parsing the block and set the var to ''

   This works.

>
> So you must mention this somewhere in the doc
> so when a PHPLIB user (like me) suddently see the block
> where previously empty they know what happen and could fix their code.

  I agree with you here.

>
> PS: the default $root should be array() rather than array('.')
> this way it's more compatible with the previous version.
>
> Hope that will help.
>
> Wassallam,
>
> -- Zakaria
>
  Best regards,
  KIR

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