Categories > TinyButStrong general >

using sub blocks in a static class

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Bourdin Géraud
Date: 2009-04-20
Time: 12:31

using sub blocks in a static class

Hello,
i am trying to use the sub-block feature from a static class whithout  globalising my var.
Here my code that works, but can't find out how to use this without globalising my var scans.


#### start code #####
class test{
    public static function testtbs($scans)
    // here is the line i would like to avoid.
            $GLOBALS['scans'] = $scans;
            $tpl = new clsTinyButStrong();
            $tpl->LoadTemplate(TEMPLATE_PATH.'contrat/documents.tpl.html');
   
            $tpl->MergeField('lien',$lien) ;
            $tpl->MergeBlock('scans','array','scans') ;
            $tpl->MergeBlock('scanInfos','array','scans[%p1%]') ;
                   
            $tpl->Show(TBS_NOTHING);
            return $tpl->Source;
    }
}
###### END CODE ######

Thanks a lot for any help :)

Best regards,
Géraud.
By: Skrol29
Date: 2009-04-22
Time: 00:28

Re: using sub blocks in a static class

Hi Géraud,

Unfortunately, that is the only whay I know.
Several people asked for a feature that enables us to merge sub-blocks directly when sub-data is part of the main-data (ie. sub-array or the main array). I'm trying some test to see if its easy or not to implement such a feature.
By: Bourdin Géraud
Date: 2009-04-22
Time: 10:06

Re: using sub blocks in a static class

Thanks for your answer. I'll look forward for any update :)
By: szaki.5
Date: 2009-07-07
Time: 16:08

Re: using sub blocks in a static class

Hi Skrol29,

Any new information of this task?

Regards
Andras
By: Skrol29
Date: 2009-07-07
Time: 22:19

Re: using sub blocks in a static class

Hi,

Yes, the feature is implemented in TBS version 3.5 which is available for download as a beta version. The feature is called Automatic Subblocks, and is documented here:

http://www.tinybutstrong.com/manual.php#html_block_autosb

Enjoy,