PHP code example of igogo5yo / yii2-render-many

1. Go to this page and download the library: Download igogo5yo/yii2-render-many library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

igogo5yo / yii2-render-many example snippets


...
class MyController extends Controller {
    use igogo5yo\rendermany\RenderMany;
    
    public function actionIndex()
    {
        
        return $this->renderMany([
            'sliderSection' => [
                'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
            ],
            'contentSection' => [
                'title' => 'My post',
                'description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry...',
            ],
            'partnersSection' => [
                'partners' => [
                    ['link' => '#', 'name' => 'partner 1'],
                    ['link' => '#', 'name' => 'partner 2'],
                    ['link' => '#', 'name' => 'partner 3'],
                ]
            ],
            'footer' //without passing variables
        ]);
    }
}


class MyController extends igogo5yo\rendermany\Controller {
    public function actionIndex()
    {
        
        return $this->renderMany([
            'sliderSection' => [
                'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
            ],
            'contentSection' => [
                'title' => 'My post',
                'description' => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry...',
            ],
            'partnersSection' => [
                'partners' => [
                    ['link' => '#', 'name' => 'partner 1'],
                    ['link' => '#', 'name' => 'partner 2'],
                    ['link' => '#', 'name' => 'partner 3'],
                ]
            ],
            'footer' //without passing variables
        ]);
    }
}

    public function actionIndex()
    {
        
        return $this->renderMany([
            'sliderSection' => [
                'slides' => ['img1.jpg', 'img3.jpg', 'img3.jpg']
            ],
            'wrapper' => [
                'innerRenders' => $this->renderManyPartial([
                    'innerView1' => [
                        'param1' => 'some data 1'.
                        'param2' => 'some data 2'
                    ],
                    'innerView2' //without passing variables
                ])
            ],
            'footer' //without passing variables
        ]);
    }