To display Sections, there are two possible approaches.
For the most simple approach, you can pass in a second array containing the names of Sections that you require displayed by name. For example:
$mergeFields = array(
'My_Title' => 'Framework Test',
'Message_Text' => 'This is a test Framework');
$subSections = array(
'Message_Box' => true);
$this->framework('Outer', $mergeFields, $subSections);
would output:
<div class="my_plugin">
<h1>Title: Framework Test</h1>
<p>This is a test Framework</p>
</div>
Sections can be given their own list of merge fields.
For example, the code above could be changed to:
$mergeFields = array(
'My_Title' => 'Framework Test');
$subSections = array(
'Message_Box' => array(
'Message_Text' => 'This is a test Framework'));
$this->framework('Outer', $mergeFields, $subSections);
This would still display the same output:
<div class="my_plugin"> <h1>Title:FrameworkTest</h1> <p>This is a testFramework</p> </div>
You can use this technique to have two Merge Fields with the same name but different values in two different Sections.
However it's best to give each different Merge Field a different name, unless you have a specific reason.
Note that in the Framework used for these tutorials, there is a section called “Another_Message_Box”. But this was never called in the example code, and hence never appeared in the output of the examples.
While you can put whatever Merge Fields or Sections you like into a Framework, when the Framework is displayed they will only appear if you ask for them in your Plugin Code.
You can add a comment here