Barebone\Viewgroup

Oke I understand, you have allready made some views and you like to load these into your barebone view. Or your view is getting messingly long and complicated and you want to divide your view into multiple.

Let's say you have a header view, with a logo and such... and below that you have your faboulus navigation bar and also a footer. This is a pretty common design standards

Now lets convert that idea to a working app. Create a new application named: "myapp" with the cmdline utility
./bb-cli.sh create application myapp

Add your existing views to the folder /myapp/views/index/ (make sure to rename the extension to .phtml)

So you end up with:

In your controller, change the indexAction to this..

<?php
function indexAction( array $args = [] ){
	
	$this->view->header = new Viewgroup(array('header', 'nav'));;
	$this->view->footer = new Viewgroup(array('footer'));;

}

In your view, change the default text to this..

<?php $header->render();?>
<h2>Hello world</h2>
<?php $footer->render();?>
  • Barebone\Viewgroup

    Barebone\Viewgroup
    • [P] $views : array
    • [M] __construct( array $views ) : void
    • [M] addView( mixed $view, string $viewname ) : void
    • [M] getView( string $viewname ) : Barebone\View
    • [M] getViews() : array
    • [M] setViews( $views ) : Barebone\Viewgroup
    • [M] render() : void