igogo5yo/yii2-render-many 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

igogo5yo/yii2-render-many

Composer 安装命令:

composer require igogo5yo/yii2-render-many

包简介

Yii Framework 2 extension for render many views in one action (best solution for landing pages or pages with many content blocks)

README 文档

README

Latest Stable Version Total Downloads License Dependency Status

Yii Framework 2 extension for render many views in one action (best solution for landing pages or pages with many content blocks)

Please submit issue reports and pull requests to the main repository. For license information check the LICENSE-file.

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist igogo5yo/yii2-render-many

or add

"igogo5yo/yii2-render-many": ">=1.0"

to your composer.json file

Example

use trait

...
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
        ]);
    }
}

or extend your controller

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
        ]);
    }
}

also you can use partial rendering

    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
        ]);
    }

统计信息

  • 总下载量: 36
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固