Categories > TinyButStrong general >

[ and ]

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: ret
Date: 2004-01-06
Time: 23:45

[ and ]

Hello.
In my html temlate code i have:
<input type=checkbox name="cats[]" value="0">
<input type=checkbox name="cats[]" value="1">

but it replaces with
<input type=checkbox name="cats&#91;]" value="0">
.. etc
How i can solve it?
By: Skrol29
Date: 2004-01-07
Time: 00:18

Re: [ and ]

Hello,

By default, "]" is replaced by "&#91;]" for each merged values.
But not for the other parts of the template.
This is a security feature.

You can cancel the replacement using the parameter protect=no.
By: ret
Date: 2004-01-07
Time: 11:37

Re: [ and ]

Thank you.
But can you give me example?
By: ret
Date: 2004-01-07
Time: 19:05

Re: [ and ]

I trying use:
[blk_cats;block=begin;protect=no]
<input type=checkbox name="cats[]" value="[blk_cats.id]"> [blk_cats.title;htmlconv=no]<br>
[blk_cats;block=end]

but it replaces with &#91; anyway :(
By: Skrol29
Date: 2004-01-07
Time: 19:44

Re: [ and ]

"protect=no" is for TBS fields only. Not for block.
In your example, the "cat[]" string is not as a value, so it should not be replaced (protected).

Is you template a sub-template ?
(any way it should not protect the string)
I going to have a check...
By: Skrol29
Date: 2004-01-07
Time: 19:57

Re: [ and ]

Hi Ret,

I've done a test and I can't reprocude your problem.
I've merged your block with a PHP array, and the "cats[]" string is not replaced.

Are your sure this part of the template is not a previously merged TBS field?
If you're still in trouble, can you send your full template to me?
By: ret
Date: 2004-01-07
Time: 21:49

Re: [ and ]

yes.
i have template.html with:
some html
[blk_cats;block=begin;protect=no]
<input type=checkbox name="cats[protect=no]" value="[blk_cats.id]"> [blk_cats.title;htmlconv=no]<br>
[blk_cats;block=end]
some html

-----
and php:

$TBS_main = new clsTinyButStrong ;
$TBS_add = new clsTinyButStrong ;
$TBS_main->LoadTemplate("index.html") ;   
$TBS_add->LoadTemplate("template.html") ;   
some code $cat_list ...
$TBS_add->MergeBlock('blk_cats','array',$cat_lst);   
$TBS_add->MergeSpecial('var');
$TBS_add->MergeSpecial('sys');

$TBS_main->MergeField('blk_main', $TBS_add->Source);
$TBS_main->Render=TBS_OUTPUT;
$TBS_main->Show() ;


(where blk_main - field in main template).
with var and sys i render some fields in template.html too.
By: ret
Date: 2004-01-07
Time: 23:37

Re: [ and ]

I found problem!
It was in main template. I put there protect=no.
Thank you!

Your TBS is best ever:) I was try many templates engenies, but TBS best. I was use it in 3-5 projects yet.