By: Piotr Budny
Date: 2008-01-12
Time: 22:56
|
Variable not set
When I'm using template like this:
<div id='content'>
[content;htmlconv=no]
</div>
I sometimes don't want to put there content; so would like to not MergeField() for
that var.
TBS shows then "[content;htmlconv=no]" literally, but should
insert nothing & display nothing (even the TBS tags).
There is "ifempty". Would be great having "ifnotset", to quietly omit the tag without display tag at all.
Regards,
vip
|
By: Skrol29
Date: 2008-01-13
Time: 15:02
|
Re: Variable not set
Hi,
You can easilly add a
$TBS->MergeField('content','');
at the end of your script. It will clean up all [content] fields.
|
By: Piotr Budny
Date: 2008-01-13
Time: 19:39
|
Re: Variable not set
Hi ho,
But if I don't know if there's [content] in my template?
That's the point. I would like automatically clean all not Merged fields/blocks.
|
By: Skrol29
Date: 2008-01-14
Time: 01:36
|
Re: Variable not set
Hi,
You cannot clean Fields or Blocks that you don't know the names.
|
By: ege
Date: 2008-01-14
Time: 11:07
|
Re: Variable not set
hmm, I had a similar problem and wrote on this forum and got an answer from Skrol29 previously. You can try something like
[var.content;htmlconv=no;noerr;block=div] |
in that case, if your $content variable is global it will display as expected. If it is not even defined, then it will remove everything, including the divs. The magical `noerr` part not only will suppress the error but also will treat as if your variable is defined like $content=""; so you should really get the results you expected.
Hope that helps.
|
|
Posting in progress.
Please wait...
|