By: era
Date: 2016-03-10
Time: 10:03
|
sub block
Hi all,
I've got some troubles in using sub-blocks that last time and I think I need some help :)
I'm using a large block with many information and many sub blocks.
Typically I have a structure like :
array(array(
'key1' => 'val1'
'key2' => 'val1'
'key3' => array(array('subkey1'=>'subval1'))
'key4' => array(array('subkey2'=>'subval2'))
'key5' => array(array('subkey3'=>'subval3'))
'key6' => array(array('subkey4'=>'subval4'))
))
|
But with that number of sub blocks (In my real structure I have like 10 sub-blocks), the template is going to be a little confuse if I have to declare (event if that works well):
[b;block=begin;sub1=(key3);sub2=(key4);sub3=(key5);sub4=(key6)]
[b.key1]
[b.key2]
[b_sub1;block=begin]
[b_sub1.subval1]
[b_sub1;block=end]
[b;block=end]
|
My question is, can we do something to have this in the template:
[b;block=begin]
[b.key1]
[b.key2]
[b.key3;block=begin]
[b.key3.subval1]
[b.key3;block=end]
[b;block=end]
|
I'm asking that because if I can handle the template side, it's not the case of all people and I'm trying to simplify that !
Thank for your time :)
|
By: era
Date: 2016-03-10
Time: 15:25
|
Re: sub block
After some research, I see a post where Skrol29 advices to do some str-replace in the php side to make template easier.
$TBS->Source = str-replace('[blockLabel]','[realBlock]');
|
|
By: Skrol29
Date: 2016-03-11
Time: 00:52
|
Re: sub block
OK
|
By: era
Date: 2016-03-11
Time: 12:04
|
Re: sub block
My answer was good until I find that sub-blocks are limited to 8.
When I use to declare nine or more sub-blocks after height they are not take...
Do you have a tip to avoid that?
|
By: era
Date: 2016-03-11
Time: 15:17
|
Re: sub block
Forget that, it was a mistake.
There is not limit, just don't forget to have continue sub (1,2,3,4,...) and not (1,2,4,...).
For my stupidity I share a little tip that I do for capture the error into an html file instead of redirect on a error page. It prevent also from downloading a corrupt file (due to error).
//Error management
$TBS->SetOption('noerr',true);
if($TBS->ErrCount>0){
$response = new Response();
$response->headers->set('Content-Type','application/html');
$response->headers->set('Content-disposition', 'filename=error.html');
return $response;
}else{
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
die();
}
|
|
|
Posting in progress.
Please wait...
|